---
title: "Receive WhatsApp messages via Kanal webhooks"
description: "Receive inbound WhatsApp messages on your server in real time with Kanal webhooks."
url: https://help.getkanal.com/en/articles/96-receive-whatsapp-messages-via-kanal-webhooks
collection: "API"
updated: 2026-11-13
language: en
alternates: [fr-fr]
---

# Receive WhatsApp messages via Kanal webhooks

Receive inbound WhatsApp messages on your server in real time with Kanal webhooks.

The Kanal webhook notifies you in real time when one of your contacts sends a WhatsApp message to your number. Ideal for plugging in a bot, feeding a CRM, or triggering server-side processing.

## Setting up a webhook

1.  Click your team name, then **Settings**.
    
2.  Open **Developers** > **Webhooks**.
    
3.  Add your server's public URL. We recommend an HTTPS URL.
    

Kanal sends a `POST` request to this URL for every incoming message, with the JSON body described below.

> **Warning:** **A single send, no automatic retry.** Kanal sends each event only once and waits 5 seconds at most for the response. If your server does not respond in time or returns an error, the event is not sent again. Respond with a 2xx code as fast as possible: Kanal does not expect any particular response body.

> **Info:** **No signature.** Requests sent by Kanal carry neither a signature nor an authentication header. To protect your endpoint, use a hard-to-guess URL, for example with a secret token in the path, and check this token on your server.

## Event format

Every webhook follows the same envelope:

```json
{
  "id": "evt_01HRXYZ...",
  "type": "message.received",
  "api_version": "2026-05-13",
  "created_at": "2026-05-13T10:00:00+00:00",
  "phone_number_id": 123,
  "data": {
    "contact": { ... },
    "message": { ... }
  }
}
```

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p><strong>Field</strong></p></th><th colspan="1" rowspan="1"><p><strong>Description</strong></p></th></tr><tr><td colspan="1" rowspan="1"><p><code>id</code></p></td><td colspan="1" rowspan="1"><p>Unique identifier of the event.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>type</code></p></td><td colspan="1" rowspan="1"><p>Event type. For now: <code>message.received</code>.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>api_version</code></p></td><td colspan="1" rowspan="1"><p>Version of the webhook contract. Lets you handle changes without breakage.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>created_at</code></p></td><td colspan="1" rowspan="1"><p>Date the event was emitted, in ISO 8601 format.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>phone_number_id</code></p></td><td colspan="1" rowspan="1"><p>ID of the Kanal WhatsApp number that received the message.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>data</code></p></td><td colspan="1" rowspan="1"><p>Object containing the contact and the received message.</p></td></tr></tbody></table>

## Contents of data

The `data` object always contains two sub-objects: `contact` and `message`.

### data.contact

```json
{
  "id": 6789,
  "phone_number": "33612345678",
  "name": "John Smith",
  "country_code": "FR"
}
```

### data.message

```json
{
  "id": 98765,
  "wamid": "wamid.HBgL...",
  "type": "text",
  "content": "Hello, I have a question",
  "media": null
}
```

The `content` field contains the usable text of the message (text body, media caption, label of a clicked button). The `media` field is filled only for media (image, video, audio, document). For button clicks and list selections, a dedicated object (`button` or `list_option`) also provides the technical identifier of the chosen option.

## Examples by message type

### Text

```json
{
  "id": "evt_01HRXYZ...",
  "type": "message.received",
  "api_version": "2026-05-13",
  "created_at": "2026-05-13T10:00:00+00:00",
  "phone_number_id": 123,
  "data": {
    "contact": {
      "id": 6789,
      "phone_number": "33612345678",
      "name": "John Smith",
      "country_code": "FR"
    },
    "message": {
      "id": 98765,
      "wamid": "wamid.HBgL...",
      "type": "text",
      "content": "Hello, I have a question",
      "media": null
    }
  }
}
```

### Image

```json
{
  "id": 98766,
  "wamid": "wamid.HBgL...",
  "type": "image",
  "content": "Here is the photo of my product",
  "media": {
    "type": "image",
    "url": "https://api.getkanal.com/api/media/messages/98766?signature=...",
    "caption": "Here is the photo of my product"
  }
}
```

The URL in the `media.url` field is a permanent signed link served by Kanal: you can store it and download the media again at any time.

### Video

```json
{
  "id": 98767,
  "wamid": "wamid.HBgL...",
  "type": "video",
  "content": null,
  "media": {
    "type": "video",
    "url": "https://api.getkanal.com/api/media/messages/98767?signature=...",
    "caption": null
  }
}
```

### Audio

```json
{
  "id": 98768,
  "wamid": "wamid.HBgL...",
  "type": "audio",
  "content": null,
  "media": {
    "type": "audio",
    "url": "https://api.getkanal.com/api/media/messages/98768?signature=...",
    "caption": null
  }
}
```

### Document

Received documents (PDF, etc.) have sent an event since August 9, 2026, with the same format as the other media types. The `media.filename` field contains the name of the file sent by the contact.

```json
{
  "id": 98769,
  "wamid": "wamid.HBgL...",
  "type": "document",
  "content": null,
  "media": {
    "type": "document",
    "url": "https://api.getkanal.com/api/media/messages/98769?signature=...",
    "caption": null,
    "filename": "invoice-10456.pdf"
  }
}
```

### Button click

```json
{
  "id": 98770,
  "wamid": "wamid.HBgL...",
  "type": "button_reply",
  "content": "Yes, I confirm",
  "media": null,
  "button": {
    "id": "4233be9add_button_1",
    "title": "Yes, I confirm"
  }
}
```

`content` contains the label of the clicked button. The `button` object also provides its technical identifier (`button.id`), useful for routing the response on your server without depending on the displayed text. This format covers both the buttons of an interactive message and a template's quick reply buttons.

### List selection

```json
{
  "id": 98771,
  "wamid": "wamid.HBgL...",
  "type": "list_reply",
  "content": "Order tracking",
  "media": null,
  "list_option": {
    "id": "cd593e96a1_row_2",
    "title": "Order tracking"
  }
}
```

Same principle: `content` contains the title of the chosen row, and `list_option.id` its technical identifier.

### Other types

Message types that Kanal does not handle arrive with `"type": "other"` and an empty `content`.

## Event types

The only event emitted is `message.received` (incoming message from a contact). Clicks on a template's quick reply buttons also arrive as `message.received`, with the `button_reply` message type. No delivery status or read receipt event is sent.

> **Info:** **Future-proof your integration.** Always filter your events on the `type` field. New types may be added: your integration will not be affected if you ignore the ones you do not handle.

## Deduplication

The `id` field (format `evt_...`) is unique for each event. Kanal never sends an event twice, but storing this identifier protects you from duplicates that your own infrastructure might create (proxy, queue).

The `wamid` field (the message's WhatsApp identifier) is also unique and stable: useful if you want to cross-reference several data sources.

## Versions and compatibility

The `api_version` field indicates the version of the webhook contract. The current version is `2026-05-13`.

-   Non-breaking additions (new fields, new event types) are deployed without changing the version.
    
-   A new version will only be published in case of a breaking change, with a transition period.
    
-   To stay compatible, your integration must ignore fields it does not recognize.
    

## Best practices

-   Return `200 OK` within 5 seconds and queue heavy processing on your server.
    
-   Monitor your endpoint's availability: an event that is not received is not sent again.
    
-   Filter events by `type` to process only what you care about.
    
-   To reply to the received message, use `POST /api/v1/messages/send` with the contact's number in the `to` field. See [Messaging API: send messages and trigger automations](https://help.getkanal.com/en/articles/81-messaging-api-send-messages-and-trigger-automations.md).
    

## Legacy fields

For compatibility with older clients (notably mobile notifications), the `title`, `body` and `text` fields are also present at the root of the payload. They contain generic English texts: "New message on Kanal" and "<name> just sent you a new message". Ignore them for a modern integration: all the useful information is in `data`.
