# Receive events by webhook

Subscribe to catalog events, look at their payloads, verify the signature and reply in time.

Guide With approval Secret key

**Before you start.** Creating webhooks needs a secret key with the webhooks:write permission, which support approves: request it from Settings › API Keys.

## Pick the events

`GET /events` returns the event catalog. You can subscribe to an exact type (`deal.won`), a whole object (`deal.*`) or all of them (`*`).

## Create the subscription

The response includes the secret used to sign deliveries. It’s shown only once: store it.

```bash
curl -X POST https://api.bydomu.com/v1/webhooks \
  -H "X-API-Key: $BYDOMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://tu-servidor.com/webhooks/bydomu",
    "eventTypes": ["deal.won", "contact.*"],
    "description": "Negocios ganados y contactos"
  }'
```

**Response · 201 · example**

```json
{
  "data": { "id": "clx1whk001", "secret": "whsec_…" }
}
```

## Verify the signature

Every delivery carries `X-Domu-Signature: t=…,v1=…`: the HMAC-SHA256 of “timestamp.body” with your secret. Use the raw body, compare in constant time and reject old timestamps.

```js
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);
}
```

[In Python, PHP and Go, with a test vector](https://developers.bydomu.com/en/guias/firma-webhooks)

## Reply in time

Up to 5 attempts (0 s, 5 s, 30 s, 2 min and 10 min) on network errors, 429 or 5xx. Reply 2xx in under 10 s.

Each delivery’s id is stable: use it to drop duplicates.

## Look at the payloads

Each delivery carries the envelope (event, id, type, timestamp, organizationId, actor) and, in data, the event’s records. `event` repeats the type, except in the four older events, where it carries the legacy name (every appointment.created arrives with VISIT_SCHEDULED). `GET /events` returns an example and a description for each of the 79 catalog events.

**Delivery · example**

contact.created:

```
{
  "event": "contact.created",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "contact.created",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "SYSTEM",
    "userId": null
  },
  "data": {
    "contact": {
      "id": "clx1con001",
      "code": "C-0042",
      "firstName": "Laura",
      "lastName": "Restrepo",
      "fullName": "Laura Restrepo",
      "email": "laura.restrepo@example.com",
      "phone": "+573000000001",
      "source": "WEBSITE",
      "status": "NEW",
      "type": "CLIENT",
      "score": 0,
      "ownerId": "clx1usr001",
      "preferredCity": null,
      "preferredType": null,
      "budget": null,
      "currency": null,
      "tags": [],
      "createdAt": "2026-09-22T14:30:00.000Z"
    }
  }
}
```

deal.stage_changed:

```
{
  "event": "deal.stage_changed",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "deal.stage_changed",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "USER",
    "userId": "clx1usr001"
  },
  "data": {
    "deal": {
      "id": "clx1deal001",
      "code": "N-0042",
      "title": "Compra apartamento Chapinero · Laura Restrepo",
      "value": 450000000,
      "currency": "COP",
      "probability": 60,
      "status": "OPEN",
      "intent": "PURCHASE",
      "leadSource": "PORTAL",
      "lostReason": null,
      "aiCreated": false,
      "agentId": "clx1usr001",
      "contactId": "clx1con001",
      "pipelineId": "clx1pip001",
      "stageId": "clx1stg003",
      "stageName": "Negociación",
      "stageEnteredAt": "2026-09-22T14:30:00.000Z",
      "expectedCloseDate": "2026-10-31T00:00:00.000Z",
      "closedAt": null,
      "createdAt": "2026-09-20T15:05:00.000Z",
      "saasPlanId": null,
      "saasPlanName": null,
      "saasBillingPeriod": null,
      "saasMrrAmount": null,
      "trialStartedAt": null,
      "trialEndsAt": null
    },
    "contact": {
      "id": "clx1con001",
      "code": "C-0042",
      "firstName": "Laura",
      "lastName": "Restrepo",
      "fullName": "Laura Restrepo",
      "email": "laura.restrepo@example.com",
      "phone": "+573000000001",
      "source": "WEBSITE",
      "status": "QUALIFIED",
      "type": "CLIENT",
      "score": 72,
      "ownerId": "clx1usr001",
      "preferredCity": "Bogotá",
      "preferredType": "APARTMENT",
      "budget": 450000000,
      "currency": "COP",
      "tags": [
        "Compra",
        "Chapinero"
      ],
      "createdAt": "2026-09-20T15:04:00.000Z"
    },
    "transition": {
      "fromStageId": "clx1stg002",
      "fromStageName": "Visita agendada",
      "toStageId": "clx1stg003",
      "toStageName": "Negociación",
      "pipelineId": "clx1pip001",
      "lostReason": null,
      "automated": false
    }
  }
}
```

deal.won:

```
{
  "event": "deal.won",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "deal.won",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "USER",
    "userId": "clx1usr001"
  },
  "data": {
    "deal": {
      "id": "clx1deal001",
      "code": "N-0042",
      "title": "Compra apartamento Chapinero · Laura Restrepo",
      "value": 450000000,
      "currency": "COP",
      "probability": 100,
      "status": "WON",
      "intent": "PURCHASE",
      "leadSource": "PORTAL",
      "lostReason": null,
      "aiCreated": false,
      "agentId": "clx1usr001",
      "contactId": "clx1con001",
      "pipelineId": "clx1pip001",
      "stageId": "clx1stg005",
      "stageName": "Ganado",
      "stageEnteredAt": "2026-09-22T14:30:00.000Z",
      "expectedCloseDate": "2026-10-31T00:00:00.000Z",
      "closedAt": "2026-09-22T14:30:00.000Z",
      "createdAt": "2026-09-20T15:05:00.000Z",
      "saasPlanId": null,
      "saasPlanName": null,
      "saasBillingPeriod": null,
      "saasMrrAmount": null,
      "trialStartedAt": null,
      "trialEndsAt": null
    },
    "contact": {
      "id": "clx1con001",
      "code": "C-0042",
      "firstName": "Laura",
      "lastName": "Restrepo",
      "fullName": "Laura Restrepo",
      "email": "laura.restrepo@example.com",
      "phone": "+573000000001",
      "source": "WEBSITE",
      "status": "QUALIFIED",
      "type": "CLIENT",
      "score": 72,
      "ownerId": "clx1usr001",
      "preferredCity": "Bogotá",
      "preferredType": "APARTMENT",
      "budget": 450000000,
      "currency": "COP",
      "tags": [
        "Compra",
        "Chapinero"
      ],
      "createdAt": "2026-09-20T15:04:00.000Z"
    },
    "transition": {
      "fromStageId": "clx1stg003",
      "fromStageName": "Negociación",
      "toStageId": "clx1stg005",
      "toStageName": "Ganado",
      "pipelineId": "clx1pip001",
      "lostReason": null,
      "automated": false
    }
  }
}
```

appointment.confirmed:

```
{
  "event": "appointment.confirmed",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "appointment.confirmed",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "USER",
    "userId": "clx1usr001"
  },
  "data": {
    "appointment": {
      "id": "clx1apt001",
      "title": "Visita · Apartamento en Chapinero Alto",
      "type": "SHOWING",
      "status": "CONFIRMED",
      "startTime": "2026-09-26T15:00:00.000Z",
      "endTime": "2026-09-26T16:00:00.000Z",
      "location": "Cra 7 #45-12, Bogotá",
      "source": "MANUAL",
      "contactId": "clx1con001",
      "dealId": "clx1deal001",
      "propertyId": "clx1prop001",
      "assigneeId": "clx1usr001",
      "attended": null,
      "cancelReason": null,
      "createdAt": "2026-09-22T14:30:00.000Z"
    },
    "contact": {
      "id": "clx1con001",
      "code": "C-0042",
      "firstName": "Laura",
      "lastName": "Restrepo",
      "fullName": "Laura Restrepo",
      "email": "laura.restrepo@example.com",
      "phone": "+573000000001",
      "source": "WEBSITE",
      "status": "QUALIFIED",
      "type": "CLIENT",
      "score": 72,
      "ownerId": "clx1usr001",
      "preferredCity": "Bogotá",
      "preferredType": "APARTMENT",
      "budget": 450000000,
      "currency": "COP",
      "tags": [
        "Compra",
        "Chapinero"
      ],
      "createdAt": "2026-09-20T15:04:00.000Z"
    },
    "property": {
      "id": "clx1prop001",
      "code": "P-0042",
      "title": "Apartamento en Chapinero Alto con balcón",
      "type": "APARTMENT",
      "transactionType": "SALE",
      "status": "ACTIVE",
      "price": 450000000,
      "rentPrice": null,
      "currency": "COP",
      "city": "Bogotá",
      "neighborhood": "Chapinero Alto",
      "address": "Cra 7 #45-12",
      "bedrooms": 3,
      "bathrooms": 2,
      "area": 85,
      "agentId": "clx1usr001",
      "createdAt": "2026-08-14T16:20:00.000Z"
    }
  }
}
```

message.received:

```
{
  "event": "message.received",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "message.received",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "SYSTEM",
    "userId": null
  },
  "data": {
    "message": {
      "id": "clx1msg001",
      "direction": "INBOUND",
      "channel": "WHATSAPP",
      "type": "TEXT",
      "text": "Hola, ¿el apartamento de Chapinero sigue disponible?",
      "mediaUrl": null,
      "conversationId": "clx1cnv001",
      "contactId": "clx1con001",
      "agentId": null,
      "sentByNoa": false,
      "timestamp": "2026-09-22T14:30:00.000Z"
    },
    "conversation": {
      "id": "clx1cnv001",
      "channel": "WHATSAPP",
      "status": "OPEN",
      "priority": "NORMAL",
      "mode": "AI",
      "contactId": "clx1con001",
      "assignedToId": "clx1usr001",
      "intent": "QUIERE_VISITA",
      "lastMessageAt": "2026-09-22T14:30:00.000Z",
      "createdAt": "2026-09-20T15:04:00.000Z"
    },
    "contact": {
      "id": "clx1con001",
      "code": "C-0042",
      "firstName": "Laura",
      "lastName": "Restrepo",
      "fullName": "Laura Restrepo",
      "email": "laura.restrepo@example.com",
      "phone": "+573000000001",
      "source": "WEBSITE",
      "status": "QUALIFIED",
      "type": "CLIENT",
      "score": 72,
      "ownerId": "clx1usr001",
      "preferredCity": "Bogotá",
      "preferredType": "APARTMENT",
      "budget": 450000000,
      "currency": "COP",
      "tags": [
        "Compra",
        "Chapinero"
      ],
      "createdAt": "2026-09-20T15:04:00.000Z"
    }
  }
}
```

property.price_changed:

```
{
  "event": "property.price_changed",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "property.price_changed",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "USER",
    "userId": "clx1usr001"
  },
  "data": {
    "property": {
      "id": "clx1prop001",
      "code": "P-0042",
      "title": "Apartamento en Chapinero Alto con balcón",
      "type": "APARTMENT",
      "transactionType": "SALE",
      "status": "ACTIVE",
      "price": 430000000,
      "rentPrice": null,
      "currency": "COP",
      "city": "Bogotá",
      "neighborhood": "Chapinero Alto",
      "address": "Cra 7 #45-12",
      "bedrooms": 3,
      "bathrooms": 2,
      "area": 85,
      "agentId": "clx1usr001",
      "createdAt": "2026-08-14T16:20:00.000Z"
    },
    "priceChange": {
      "previousPrice": 450000000,
      "newPrice": 430000000,
      "currency": "COP"
    }
  }
}
```

lease.expiring:

```
{
  "event": "lease.expiring",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "lease.expiring",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "SYSTEM",
    "userId": null
  },
  "data": {
    "lease": {
      "id": "clx1lea001",
      "code": "A-0007",
      "status": "ACTIVE",
      "startDate": "2025-11-01T00:00:00.000Z",
      "endDate": "2026-10-31T00:00:00.000Z",
      "daysToEnd": 30,
      "monthlyRent": 3200000,
      "adminFee": 380000,
      "currency": "COP",
      "paymentDayOfMonth": 5,
      "propertyId": "clx1prop002",
      "tenantId": "clx1con002",
      "ownerId": "clx1con003",
      "managerId": "clx1usr001",
      "createdAt": "2025-10-28T19:00:00.000Z"
    },
    "contact": {
      "id": "clx1con002",
      "code": "C-0043",
      "firstName": "Camilo",
      "lastName": "Duarte",
      "fullName": "Camilo Duarte",
      "email": "camilo.duarte@example.com",
      "phone": "+573000000002",
      "source": "REFERRAL",
      "status": "WON",
      "type": "CLIENT",
      "score": 90,
      "ownerId": "clx1usr001",
      "preferredCity": "Medellín",
      "preferredType": "APARTMENT",
      "budget": 3200000,
      "currency": "COP",
      "tags": [
        "Arrendatario"
      ],
      "createdAt": "2025-11-02T13:00:00.000Z"
    },
    "property": {
      "id": "clx1prop002",
      "code": "P-0057",
      "title": "Apartamento en El Poblado cerca a la estación",
      "type": "APARTMENT",
      "transactionType": "RENT",
      "status": "RENTED",
      "price": null,
      "rentPrice": 3200000,
      "currency": "COP",
      "city": "Medellín",
      "neighborhood": "El Poblado",
      "address": "Cl 10 #43-20",
      "bedrooms": 2,
      "bathrooms": 2,
      "area": 68,
      "agentId": "clx1usr001",
      "createdAt": "2025-10-20T14:00:00.000Z"
    },
    "threshold": 30,
    "daysToEnd": 30
  }
}
```

rent_payment.overdue:

```
{
  "event": "rent_payment.overdue",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "rent_payment.overdue",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "SYSTEM",
    "userId": null
  },
  "data": {
    "rentPayment": {
      "id": "clx1rpy002",
      "period": "2026-10",
      "status": "OVERDUE",
      "totalAmount": 3580000,
      "paidAmount": null,
      "currency": "COP",
      "dueDate": "2026-10-05T00:00:00.000Z",
      "paidAt": null,
      "daysOverdue": 3,
      "leaseId": "clx1lea001",
      "tenantId": "clx1con002",
      "propertyId": "clx1prop002"
    },
    "lease": {
      "id": "clx1lea001",
      "code": "A-0007",
      "status": "ACTIVE",
      "startDate": "2025-11-01T00:00:00.000Z",
      "endDate": "2026-10-31T00:00:00.000Z",
      "daysToEnd": 23,
      "monthlyRent": 3200000,
      "adminFee": 380000,
      "currency": "COP",
      "paymentDayOfMonth": 5,
      "propertyId": "clx1prop002",
      "tenantId": "clx1con002",
      "ownerId": "clx1con003",
      "managerId": "clx1usr001",
      "createdAt": "2025-10-28T19:00:00.000Z"
    },
    "contact": {
      "id": "clx1con002",
      "code": "C-0043",
      "firstName": "Camilo",
      "lastName": "Duarte",
      "fullName": "Camilo Duarte",
      "email": "camilo.duarte@example.com",
      "phone": "+573000000002",
      "source": "REFERRAL",
      "status": "WON",
      "type": "CLIENT",
      "score": 90,
      "ownerId": "clx1usr001",
      "preferredCity": "Medellín",
      "preferredType": "APARTMENT",
      "budget": 3200000,
      "currency": "COP",
      "tags": [
        "Arrendatario"
      ],
      "createdAt": "2025-11-02T13:00:00.000Z"
    },
    "property": {
      "id": "clx1prop002",
      "code": "P-0057",
      "title": "Apartamento en El Poblado cerca a la estación",
      "type": "APARTMENT",
      "transactionType": "RENT",
      "status": "RENTED",
      "price": null,
      "rentPrice": 3200000,
      "currency": "COP",
      "city": "Medellín",
      "neighborhood": "El Poblado",
      "address": "Cl 10 #43-20",
      "bedrooms": 2,
      "bathrooms": 2,
      "area": 68,
      "agentId": "clx1usr001",
      "createdAt": "2025-10-20T14:00:00.000Z"
    },
    "daysOverdue": 3
  }
}
```

ticket.created:

```
{
  "event": "ticket.created",
  "id": "5f3a0c1e-7d2b-4f7e-9a51-0b6c1d2e3f40",
  "type": "ticket.created",
  "timestamp": "2026-09-22T14:30:00.000Z",
  "organizationId": "clx1org001",
  "actor": {
    "kind": "USER",
    "userId": "clx1usr001"
  },
  "data": {
    "ticket": {
      "id": "clx1tkt001",
      "number": 12,
      "code": "T-0012",
      "title": "No llegan las fotos al portal",
      "summary": "La clienta dice que la ficha P-0042 se ve sin fotos desde ayer.",
      "status": "PENDING",
      "priority": "HIGH",
      "channel": "WHATSAPP",
      "labels": [
        "Portales"
      ],
      "assignedToId": "clx1usr001",
      "assignedToName": "Andrés Mejía",
      "contactId": "clx1con001",
      "conversationId": "clx1cnv001",
      "linearIssueKey": null,
      "url": "https://www.bydomu.com/inbox/tickets/clx1tkt001",
      "resolvedAt": null,
      "createdAt": "2026-09-22T14:30:00.000Z",
      "updatedAt": "2026-09-22T14:30:00.000Z"
    },
    "contact": {
      "id": "clx1con001",
      "code": "C-0042",
      "firstName": "Laura",
      "lastName": "Restrepo",
      "fullName": "Laura Restrepo",
      "email": "laura.restrepo@example.com",
      "phone": "+573000000001",
      "source": "WEBSITE",
      "status": "QUALIFIED",
      "type": "CLIENT",
      "score": 72,
      "ownerId": "clx1usr001",
      "preferredCity": "Bogotá",
      "preferredType": "APARTMENT",
      "budget": 450000000,
      "currency": "COP",
      "tags": [
        "Compra",
        "Chapinero"
      ],
      "createdAt": "2026-09-20T15:04:00.000Z"
    }
  }
}
```

The data is made up; the shape is real. .deleted events only carry id, name and code, since the record no longer exists.
