# message.received

> The ByDomu message.received event (Message from the customer): when it fires, how to subscribe, its fields and the payload delivered by webhook.


Message from the customer

Object · message Includes · conversation Includes · contact Instant

## When it fires

A customer message arrived on any channel (WhatsApp, Instagram, Facebook, email, web chat…). Carries the message, the conversation and the contact.

Instantly, when it happens in ByDomu: from the app, the API, Noa, an automation or an integration. `actor.kind` tells you who: USER, NOA, SYSTEM, API, AUTOMATION or INTEGRATION.

## Subscribe with

- `message.received` Only this event
- `message.*` Every event of Message
- `*` The whole catalog

## Fields it carries

paths for filters and templates

`message.id` Message id

`message.direction` Inbound or outbound

`message.channel` Channel

`message.type` Message type

`message.text` Message text

`message.conversationId` Conversation

`message.contactId` Contact

`message.sentByNoa` Sent by Noa

`conversation.id` Conversation id

`conversation.channel` Channel

`conversation.status` Conversation status

`conversation.priority` Priority

`conversation.mode` Who replies

`conversation.contactId` Contact

`conversation.assignedToId` Owner

`conversation.intent` Intent

`contact.id` Contact id

`contact.code` Contact code

`contact.firstName` First name

`contact.lastName` Last name

`contact.email` Email

`contact.phone` Phone

`contact.source` Source

`contact.status` Status

`contact.type` Contact type

`contact.score` Score

`contact.ownerId` Owner

`contact.preferredCity` City of interest

`contact.preferredType` Property type they want

`contact.budget` Budget

`contact.tags` Tags

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.

Payload:

```
{
  "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"
    }
  }
}
```

Headers:

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

Verify signature:

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

**Get it with your test data** GET /v1/webhooks/sample/message.received

[Try it](https://developers.bydomu.com/en/referencia/get-webhook-sample?probar=1&type=message.received)
