Notifications
This documentation describes how to receive Webhook Callback Events in your system.
When a customer sends you a message, the WhatsApp Business API client will send an HTTP POST request notification to the webhook URL.
The following is an example of a text message you received from a customer:
{
"object": "whatsapp_business_account",
"entry": [{
"id": "WHATSAPP_BUSINESS_ACCOUNT_ID",
"changes": [{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": PHONE_NUMBER,
"phone_number_id": PHONE_NUMBER_ID
},
"contacts": [{
"profile": {
"name": "NAME"
},
"wa_id": PHONE_NUMBER
}],
"messages": [{
"from": PHONE_NUMBER,
"id": "wamid.ID",
"timestamp": TIMESTAMP,
"text": {
"body": "MESSAGE_BODY"
},
"type": "text"
}]
},
"field": "messages"
}]
}]
}
When you receive an incoming notification, you must response with status 200 - acknowledging the webhook was received.
- 302-redirect: Redirects are not followed by the webhook gateway Please ensure that there is always HTTPS
200
as a response code. - SSL-errors: Please ensure that the callback-URLs are using SSL/TLS, and that the certificates are valid and that the certificate chain is complete.
- You start processing in the callback thread. Please do only acknowledge messages and notifications and start processing in a separate thread.
- Callbacks will be terminated after a defined timeout and there will be a retry.
- Duplicates messages can be sent to a WhatsApp webhook as the only guarantee provided is that messages will be received at least once (as opposed to exactly once). If this is affecting how messages are processed on your end, then we suggest deduping webhook messages based on the
message_id
.
Last modified 29d ago