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
POSTwithContent-Type: application/json. - Your endpoint must answer within 10 seconds. Answer
200right away and process the event asynchronously. - When your endpoint cannot be reached, times out, or answers
408,429or a5xxstatus, the event is sent again after 30 seconds, then 2 minutes, then 10 minutes. Retries carry anX-Communiktor-Retryheader 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 eventdata: object ornull— 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.
| Event | When |
|---|---|
message.sent | The message was sent to WhatsApp. |
message.sent.failed | The message could not be sent. data.reason explains why (Receiver not registered on WhatsApp, Error while sending the message). |
message.received | The message was delivered to the recipient's phone (double grey tick). |
message.read | The 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,locationorvcard. Stickers are sent asimage, voice notes asaudio, video notes asvideo. 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, …),nullotherwise.sender: the sender's phone number for a direct message,nullin a group. It can also benullwhen WhatsApp hides the number.name: the name on the sender's WhatsApp profile, if any.group:trueif the message was posted in a group.group_idis then the group identifier andparticipantthe phone number of its author.timestamp: when the message was sent, in ISO 8601 (UTC).reply_to: theidof the message this one replies to,nullotherwise.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.nullwhen the file was not kept: in groups, above 64 MB, or when WhatsApp no longer had it.mime,size(bytes) andfile_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
| Event | When | data |
|---|---|---|
instance.qr.generated | A 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.generated | A pairing code was generated (see Link an instance with a pairing code). | { "code": "KJ7FHM6E" } |
instance.connected | The instance is connected to WhatsApp and ready to send and receive messages. | null |
instance.disconnected | The 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.stopped | The instance was stopped. No events are sent until it is started again. | null |
Best practices
- Answer fast: return
200immediately 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
instanceis 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.messagefor the messages you send,data.message.idfor 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.