Skip to main content

Webhooks Integration

Webhooks notify your server in real time of what happens on your instances: incoming messages, delivery and read reports, calls, connection changes.

Activation​

  • Webhooks are configured per instance. In your Communiktor dashboard, open the instance page, set the webhook URL, and select the events you want to receive. Only the selected events are sent.
  • Changes are applied within a minute, without restarting the instance.
  • The URL must be publicly reachable. Private network addresses (localhost, 10.x, 192.168.x, …) are refused. Use HTTPS.

Delivery​

  • Each event is sent as an HTTP POST with Content-Type: application/json.
  • Your endpoint must answer within 10 seconds. Answer 200 right away and process the event asynchronously.
  • When your endpoint cannot be reached, times out, or answers 408, 429 or a 5xx status, the event is sent again after 30 seconds, then 2 minutes, then 10 minutes. Retries carry an X-Communiktor-Retry header with the attempt number (1, 2, 3). Other statuses (400, 404, …) are not retried.
  • QR codes and pairing codes are never retried: they expire within seconds.
  • Retries are best effort. To be sure you have every direct message your instance received, list them with the API, which keeps them for 30 days.

Payload​

Every webhook has the same structure:

  • event: string — The event key (see the list below)
  • instance: string — The instance identifier emitting the event
  • data: object or null — Event-specific payload
{
"event": "message.incoming",
"instance": "my-instance-1",
"data": {
"message": {
"id": "3EB0C767D26A1D8B4F3A",
"type": "text",
"text": "Hello",
"mime": null,
"sender": "14155552671",
"name": "Ana",
"group": false,
"group_id": null,
"participant": null,
"timestamp": "2026-11-26T10:15:00.000Z",
"reply_to": null,
"media": null,
"location": null,
"contact": null
},
"metadata": {}
}
}

Events​

Messages you send​

These events concern messages sent through the API. data.message describes the message: its identifier (message, the value returned by the API as data.message), receiver, group, and its content (text, or url and caption for media, …). data.metadata is the metadata object you sent with the message.

EventWhen
message.sentThe message was sent to WhatsApp.
message.sent.failedThe message could not be sent. data.reason explains why (Receiver not registered on WhatsApp, Error while sending the message).
message.receivedThe message was delivered to the recipient's phone (double grey tick).
message.readThe recipient read the message (blue ticks). Only sent when the recipient has read receipts enabled.
{
"event": "message.read",
"instance": "my-instance-1",
"data": {
"message": {
"instanceId": "my-instance-1",
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d",
"receiver": "14155552671",
"group": false,
"text": "Your order #12345 has shipped"
},
"metadata": { "orderId": "12345" }
}
}

message.sent.failed adds the reason:

{
"event": "message.sent.failed",
"instance": "my-instance-1",
"data": {
"message": {
"instanceId": "my-instance-1",
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d",
"receiver": "14155552671",
"group": false,
"url": "https://example.com/invoice.pdf",
"filename": "invoice.pdf"
},
"reason": "Error while sending the message",
"metadata": { "orderId": "12345" }
}
}

Messages you receive​

message.incoming: the instance received a new message from a contact or a group. Messages sent from your own phone, contacts' statuses and channel posts are not included.

data.message contains:

  • id: the WhatsApp identifier of the message. Use it to ignore an event you already processed.
  • type: text, image, video, audio, document, location or vcard. Stickers are sent as image, voice notes as audio, video notes as video. Reactions, polls, edits and deleted messages are not sent.
  • text: the text of the message, or the caption of an image, video or document (empty if none).
  • mime: the MIME type of a file (image/jpeg, application/pdf, …), null otherwise.
  • sender: the sender's phone number for a direct message, null in a group. It can also be null when WhatsApp hides the number.
  • name: the name on the sender's WhatsApp profile, if any.
  • group: true if the message was posted in a group. group_id is then the group identifier and participant the phone number of its author.
  • timestamp: when the message was sent, in ISO 8601 (UTC).
  • reply_to: the id of the message this one replies to, null otherwise.
  • media: for images, videos, audio and documents, the file:
    • url: a temporary link to download it, valid 24 hours (expires_at). Images, videos and audio open in the browser, other files are downloaded. null when the file was not kept: in groups, above 64 MB, or when WhatsApp no longer had it.
    • mime, size (bytes) and file_name (documents).
  • location: for a location, { "latitude", "longitude", "name", "address" }.
  • contact: for a contact card, { "name", "vcard" } with the card in vCard format.
{
"event": "message.incoming",
"instance": "my-instance-1",
"data": {
"message": {
"id": "3EB0A1B2C3D4E5F60718",
"type": "document",
"text": "Here is my order",
"mime": "application/pdf",
"sender": "14155552671",
"name": "Ana",
"group": false,
"group_id": null,
"participant": null,
"timestamp": "2026-11-26T10:16:42.000Z",
"reply_to": "3EB0C767D26A1D8B4F3A",
"media": {
"url": "https://…/incoming/…?X-Amz-Expires=86400&X-Amz-Signature=…",
"expires_at": "2026-11-27T10:16:44.000Z",
"mime": "application/pdf",
"size": 48213,
"file_name": "order.pdf"
},
"location": null,
"contact": null
},
"metadata": {}
}
}

Messages received in direct conversations are also kept for 30 days, with their files, and can be listed with the API whether this webhook is enabled or not.

Calls​

call.received — The instance receives a voice or video call.

{
"event": "call.received",
"instance": "my-instance-1",
"data": {
"from": "14155552671",
"group": null
}
}

data.group is the group name for a group call, null otherwise.

Instance status​

EventWhendata
instance.qr.generatedA new QR code is available to link the instance (renewed about every 20 seconds).{ "qrCode": "..." }, the content to render as a QR code
instance.pair.code.generatedA pairing code was generated (see Link an instance with a pairing code).{ "code": "KJ7FHM6E" }
instance.connectedThe instance is connected to WhatsApp and ready to send and receive messages.null
instance.disconnectedThe instance was logged out of WhatsApp, for example because the device was removed from the phone's linked devices. It must be linked again.null
instance.stoppedThe instance was stopped. No events are sent until it is started again.null

Best practices​

  • Answer fast: return 200 immediately and queue the processing on your side.
  • Secure your endpoint: webhooks are not signed yet. Use a hard-to-guess URL (for example with a long random token in the path), check that instance is one of yours, and do not trust the payload for sensitive actions without checking with your own data.
  • Be idempotent: an event can arrive twice (a retry after your endpoint answered too late). Use the message identifier (data.message.message for the messages you send, data.message.id for the messages you receive) to ignore an event you have already processed.
  • Log the events you receive (event, instance, message identifier) to investigate delivery issues.