# referral.converted

> El evento referral.converted (Referido convertido) de ByDomu: cuándo se emite, cómo suscribirse, sus campos y el payload que llega por webhook.


Referido convertido

Objeto · referral Al instante

## Cuándo se emite

El referido se convirtió en negocio. conversion trae el estado anterior y el negocio; automatic es true si pasó al cerrar la comisión.

Al instante, cuando pasa en ByDomu: desde la app, la API, Noa, una automatización o una integración. `actor.kind` dice quién fue: USER, NOA, SYSTEM, API, AUTOMATION o INTEGRATION.

## Suscríbete con

- `referral.converted` Solo este evento
- `referral.*` Todos los de Referido
- `*` Todo el catálogo

## Campos que trae

rutas para filtrar y plantillas

`referral.id` Identificador del referido

`referral.status` Estado del referido

`referral.leadName` Nombre del referido

`referral.leadPhone` Teléfono del referido

`referral.referredContactId` Contacto referido

Hasta 5 intentos (0 s, 5 s, 30 s, 2 min y 10 min) ante error de red, 429 o 5xx. Responde 2xx en menos de 10 s.

Payload:

```
{
  "event": "referral.converted",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "referral.converted",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "USER",
    "userId": "clx1usr001"
  },
  "data": {
    "referral": {
      "id": "clx1ref001",
      "status": "CONVERTED",
      "leadName": "Sofía Herrera",
      "leadPhone": "+573000000004",
      "leadEmail": "sofia.herrera@example.com",
      "referredContactId": "clx1con004",
      "dealId": "clx1deal002",
      "createdAt": "2026-09-22T14:30:00.000Z"
    },
    "conversion": {
      "previousStatus": "QUALIFIED",
      "dealId": "clx1deal002"
    }
  }
}
```

Encabezados:

```
X-Domu-Event: referral.converted
X-Domu-Signature: t=1790610130,v1=9c1e…
User-Agent: Domu-Webhooks/2
```

Verificar firma:

```
import { createHmac, timingSafeEqual } from "node:crypto";

// header = X-Domu-Signature: t=<timestamp>,v1=<hmac>
function verifyWebhook(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const timestamp = Number(parts.t);
  if (!timestamp || !parts.v1) return false;
  if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSec) return false;
  const expected = createHmac("sha256", secret)
    .update(`${timestamp}.${rawBody}`)
    .digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1);
  return a.length === b.length && timingSafeEqual(a, b);
}
```

**Pídelo con tus datos de prueba** GET /v1/webhooks/sample/referral.converted

[Probar](https://developers.bydomu.com/referencia/get-webhook-sample?probar=1&type=referral.converted)
