Webhooks
This documentation describes how to setup webhooks for the WhatsApp Business API.

Introduction

Webhooks are one of a few ways web applications can communicate with each other. It allows you to send real-time data from one application to another whenever a given event occurs. You can use the webhook to determine to which endpoint we should forward the real-time data (or also known as Notifications). Whenever that trigger event occurs, the WhatsApp Business API client sees the event, collects the data, and immediately sends a notification (user-defined HTTP callbacks) to the webhook URL specified in the application settings. Some example events are: - updating the status of sent messages - indicating when you receive a message
Only HTTPS webhook URLs on port 443 are valid.
It is important that your webhook returns an HTTPS 200 OK response to any notifications. Otherwise we consider that notification as failed and try again after a short delay.

Never process incoming messages and notifications in the callback handler!

Only use asynchronous handling of callbacks - acknowledge immediately after receiving the callback, then process.
All incoming messages will automatically shown as delivered (two grey ticks). To make them appear as read (two colored ticks), you have to mark the messages as read.

1. Set Webhook URL

The webhook URL is a URL where the WhatsApp Business API sends the notifications to, triggered by specific events.
The webhook URL can either be: - the URL from your own application - or the partner

Request Schema:

post
/v1/configs/webhook
submit an entity to the specified resource.
Body
1
{
2
"url": URL,
3
"headers": {
4
"header_1": string,
5
"header_2": string
6
}
7
}
Copied!

Example setting webhook with Basic Auth:

If the webhook URL needs to be authorized by user, USER and PASS should be provided in the header Authorization that contains Basic base64(USER:PASS).
Request body example for USER=testuser and PASS=testpass
Body
1
{
2
"url": "https://www.example.com/webhook",
3
"headers": {
4
"Authorization": "Basic dGVzdHVzZXI6dGVzdHBhc3M="
5
}
6
}
Copied!

2. Get Webhook URL

If the webhook URL is already set up as described above, you can send a GET request to get the URL.

Request Schema:

get
/v1/configs/webhook
requests a representation of the specified resource.

Example:

Request
Response
1
D360-API-KEY: adafABC43
2
Content-Type: application/json
Copied!
1
{
2
"url": "https://www.example.com/webhook",
3
"headers": {
4
"Authorization": "Basic dGVzdHVzZXI6dGVzdHBhc3M="
5
}
6
}
Copied!
Last modified 3mo ago