Webhook
message_created

Message created

Notifies your endpoint when a WhatsApp message is received or sent.

Registering your endpoint

The Eclectic team registers your endpoint. Send us its HTTPS URL and, if you want to verify our calls, a header to include in every request (for example an authorization token). Each event arrives as a POST with a JSON body.

Trigger

Sent when a contact writes to you, when your AI agent replies, when your team writes from the WhatsApp Business app, and when you send a message through POST /messages/send. Messages sent from the Eclectic inbox, campaigns and flows do not trigger it. It covers WhatsApp only.

Payload fields

  • uuidIdentifier of the message.
  • statusreceived for messages from the contact, sent for messages from your business, or failed if delivery failed.
  • sentByWho wrote it: contact (the customer), agent (your AI agent), whatsapp_app (your team, from the WhatsApp Business app) or api (a message sent through this API).
  • channelAlways whatsapp.
  • createdAtWhen the message was created (ISO 8601, UTC).
  • fromSender's phone number, digits only with country code.
  • toRecipient's phone number, digits only with country code.
  • textMessage text. Empty for file-only messages.
  • attachmentsDownload URLs of the message's files.
  • mediaThe same files as objects: id, url, filename and contentType (filename and contentType may be null).
  • metadataThe metadata you sent with POST /messages/send, or an empty object.
  • contactThe contact: uuid, name, phoneNumber (with +), email, tags, customFields, assignedUser (email of the assigned team member), createdAt, closedAt, and links to open the contact (href) and the chat (conversationHref) in Eclectic.

File URLs expire 120 minutes after the event. Download files promptly, or call GET /media/:id with the media item's id to get a fresh URL.

Each event is sent once and is not retried: answer quickly with a 2xx and process the event afterwards. Redirects are not followed. To recover messages your endpoint missed, use GET /messages.

Example payload

json
{
  "event": "message_created",
  "payload": {
    "uuid": "7f1c2d9e-4b8a-4f0e-9c3d-2a6b5e8f1c42",
    "status": "received",
    "sentBy": "contact",
    "channel": "whatsapp",
    "createdAt": "2026-10-18T12:06:29.481203Z",
    "from": "56912345678",
    "to": "56987654321",
    "text": "Hello, here is the quote",
    "attachments": [
      "https://storage.example.com/cotizacion.pdf?signature=..."
    ],
    "media": [
      {
        "id": 482,
        "url": "https://storage.example.com/cotizacion.pdf?signature=...",
        "filename": "cotizacion.pdf",
        "contentType": "application/pdf"
      }
    ],
    "metadata": {},
    "contact": {
      "uuid": "eb2b914a-977e-4ab8-96e7-b886698b3eac",
      "name": "John Doe",
      "phoneNumber": "+56912345678",
      "email": "john@example.com",
      "tags": ["Lead"],
      "customFields": { "rut": "12.345.678-9" },
      "assignedUser": "seller@example.com",
      "avatarUrl": null,
      "source": "whatsapp",
      "createdAt": "2026-10-12T15:57:16.120938Z",
      "closedAt": null,
      "href": "https://www.eclecticlabs.com/app/contacts/contact?contactId=eb2b914a-977e-4ab8-96e7-b886698b3eac",
      "conversationHref": "https://www.eclecticlabs.com/app/inbox/f3670b13-446b-4127-9623-8b1cd78899f9"
    }
  }
}