After setting the webhook from Setting WA Webhook documentation, we will forward the WA webhook to your URL that has been set. There the examples from some WA webhooks.
Sample when WA receives a message.
{
"app_code": "ramo-29lxxxxxxxxpsaio",
"channel_id": 7xx,
"contacts": [
{
"profile": {
"name": "Andrianto Anggoro"
},
"wa_id": "6281xxxxxx80"
}
],
"messages": [
{
"from": "6281xxxxxx80",
"id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMDU4Njc4NzhFMUEzQzQxQUU1RAA=",
"text": {
"body": "Hi Qiscus"
},
"timestamp": "1694619169",
"type": "text"
}
],
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "6282xxxxxx902",
"phone_number_id": "2614280515347021"
}
}
Webhook sample when WA receives a media message.
{
"app_code": "ramo-29lxxxxxxxxpsaio",
"channel_id": 7xx,
"contacts": [
{
"profile": {
"name": "Andrianto Anggoro"
},
"wa_id": "6281xxxxxx80"
}
],
"messages": [
{
"from": "6281xxxxxx80",
"id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMDVCMTg1RTZDQTk4QkI2N0U5NgA=",
"image": {
"id": "1638370866648411",
"mime_type": "image/jpeg",
"sha256": "PLCSaS2RZQMy5gMvMOe41mto2xE4wSXmntSDIAau/kU="
},
"timestamp": "1694619570",
"type": "image"
}
],
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "6282xxxxxx902",
"phone_number_id": "2614280515347021"
}
}
Note: If you receive a media message, you can get the media attached using this API (Retrieve Media API)
Sample when the customer replies message with Quick Reply button
{
"app_code": "ramo-29lxxxxxxxxpsaio",
"channel_id": 7xx,
"contacts": [
{
"profile": {
"name": "Andrianto Anggoro"
},
"wa_id": "6281xxxxxx80"
}
],
"messages": [
{
"button": {
"payload": "payload-1",
"text": "All Okay"
},
"context": {
"from": "6282xxxxxx902",
"id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSODM5RkQ1RDE0QzFBMUVFOTZFAA=="
},
"from": "6281xxxxxx80",
"id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMEU4NUVCNjJDQjcwMjI0ODI2NQA=",
"timestamp": "1694675589",
"type": "button"
}
],
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "6282241734902",
"phone_number_id": "2614280515347021"
}
}
Webhook sample when WA success sends a message
{
"app_code": "ramo-29lxxxxxxxxpsaio",
"channel_id": 7xx,
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "6282xxxxxx902",
"phone_number_id": "2614280515347021"
},
"statuses": [
{
"conversation": {
"expiration_timestamp": "1694705580",
"id": "9c735a8f8fcd597f35dd8d2035d89fc0",
"origin": {
"type": "service"
}
},
"id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSOEFFMDg0MzlGMEFERkEwODMxAA==",
"pricing": {
"billable": true,
"category": "service",
"pricing_model": "CBP"
},
"recipient_id": "6281xxxxxx80",
"status": "sent",
"timestamp": "1694619174"
}
]
}
Note: WhatsApp will send the webhook for every message (by id) if updated to delivered or read.
"status": "delivered",
or
"status": "read",
Webhook sample when WA failed sends a message
{
"app_code": "ramo-29lxxxxxxxxpsaio",
"channel_id": 7xx,
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "6282xxxxxx902",
"phone_number_id": "2614280515347021"
},
"statuses": [
{
"errors": [
{
"code": 131026,
"title": "Message Undeliverable."
}
],
"id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSQThGRjNENEJDN0M5OTg2NjkxAA==",
"recipient_id": "6281xxxxxx80",
"status": "failed",
"timestamp": "1704520832"
}
]
}
Note: The error code or the title may be different, you can check your error code here Error Code
Comments
0 comments
Please sign in to leave a comment.