Skip to main content

WhatsApp Webhooks

In here you can see what a WhatsApp webhook event has as payload.

New Message Received

The field sent_by will have the value user, and if the sender is part of your contacts, you will also find a contact field inside the payload.

The value of remote_phone_number is the phone number of the user that sent you the message.

{
"id":"MSGcf20bbdb-0a8a-4eef-bca1-aa2ea22c5294",
"uuid":"MSGcf20bbdb-0a8a-4eef-bca1-aa2ea22c5294",
"created_at":"2023-04-18T22:17:50Z",
"session_key":"WW-WPN1045d068-6c42-4157-8325-41e3c5710dc6-5215533334444@c.us",
"message":{
"media":{
"url":"https://2chat-user-data.s3.amazonaws.com/ACC28526e8e-ac01-4b1f-ac11-939f2b7fca73/example.jpeg",
"type":"image",
"mime_type":"image/jpeg"
}
},
"remote_phone_number":"+5215533334444",
"sent_by":"user",
"contact":{
"first_name":"Johny",
"last_name":"Doe",
"profile_pic_url":"https://2chat-user-data.s3.amazonaws.com/example-profile-pic.jpeg"
}
}

New Order Received

Inside the message field, you will find an object containing the order details.

{
"id": "MSGa13150ca-13e5-4c0a-b979-f45980830c10",
"uuid": "MSGa13150ca-13e5-4c0a-b979-f45980830c10",
"session_key": "WW-WPN66037eca-9ad1-4c96-9eff-526a90a48c77-5215533334444@c.us",
"message": {
"text": "ADIDAS | CLASSIC BACKPACK | LEGEND INK MULTICOLOUR Regular, NIKE | SWOOSH PRO FLAT PEAK CAP Regular",
"order": {
"subtotal": 0,
"total": 0,
"currency": null,
"created_at": 1710021608,
"products": [
{
"id": "6562709013816345",
"name": "ADIDAS | CLASSIC BACKPACK | LEGEND INK MULTICOLOUR Regular",
"price": 150.5,
"currency": "USD",
"quantity": 1,
"data": null,
"thumbnail_url": "https://2chat-user-data-dev.s3.amazonaws.com/order/product/6562709013816345.jpeg"
},
{
"id": "7096834393683427",
"name": "NIKE | SWOOSH PRO FLAT PEAK CAP Regular",
"price": 210.0,
"currency": "USD",
"quantity": 1,
"data": null,
"thumbnail_url": "https://2chat-user-data-dev.s3.amazonaws.com/order/product/7096834393683427.jpeg"
}
]
}
},
"created_at": "2024-03-09T22:00:08",
"remote_phone_number": "+5215533334444",
"channel_phone_number": "+595981461442",
"sent_by": "user",
"contact": {
"first_name": null,
"last_name": null,
"profile_pic_url": null
}
}

New Message Sent

The field sent_by will have the value agent.

The value of remote_phone_number is the phone number of the user you sent the message to.

{
"id":"MSGcf20bbdb-0a8a-4eef-bca1-aa2ea22c5294",
"uuid":"MSGcf20bbdb-0a8a-4eef-bca1-aa2ea22c5294",
"created_at":"2023-04-18T22:17:50Z",
"session_key":"WW-WPN1045d068-6c42-4157-8325-41e3c5710dc6-5215533334444@c.us",
"message":{
"text": "this is the text content of the message"
},
"remote_phone_number":"+5215533334444",
"sent_by":"agent",
}