Types of payloads
This section explains the inbound event type message you receive on your callback URL. It states that a customer has sent a message to your WhatsApp Business API phone number. Here, we will understand the different types of payloads for inbound messages.
Text
{
"app": "DemoApp",
"timestamp": 1580227766370,
"version": 2,
"type": "message",
"payload": {
"id": "ABEGkYaYVSEEAhAL3SLAWwHKeKrt6s3FKB0c",
"source": "918x98xx21x4",
"type": "text",
"payload": {
"text": "Hi"
},
"sender": {
"phone": "918x98xx21x4",
"name": "Andy",
"country_code": "91",
"dial_code": "8x98xx21x4"
}
}
}Common payload for all inbound events of type message
message{
"app": "DemoApp",
"timestamp": 1580227766370,
"version": 2,
"type": "message",
"payload": {
"id": "ABEGkYaYVSEEAhAL3SLAWwHKeKrt6s3FKB0c",
"source": "918x98xx21x4",
"type": "text"|"image"|"file"|"audio"|"video"|"contact"|"location"|"button_reply"|"list_reply",
"payload": {
// Varies according to the type of payload.
},
"sender": {
"phone": "918x98xx21x4",
"name": "Drew",
"country_code": "91",
"dial_code": "8x98xx21x4"
},
"context": {
"id": "gBEGkYaYVSEEAgnPFrOLcjkFjL8",
"gsId": "9b71295f-f7af-4c1f-b2b4-31b4a4867bad"
}
}
}Common payload object description
Key | Description | Sample |
|---|---|---|
| The name of the Gupshup app to which the customer has sent a message on WhatsApp | DemoAPI |
| The time in UNIX timestamp when the message sent by the customer was received by Gupshup | 1584898839530 |
| Callback payload version | 2 |
| The type of inbound event |
|
| The payload object represents the following:
| See the payload object description for more information. |
| The sender object represents the following: | See the sender object description for more information. |
| The context object is optional, it will only be included when someone replies to one of your messages. It contains information about the content of the original message, such as the Gupshup ID and WhatsApp ID of the message. | See the context object description for more information. |
The payload object description
Key | Description | Sample |
|---|---|---|
| The unique WhatsApp message identifier for the inbound message | ABEGkYaYVSEEAhAt2MgAKjL1qGe88OKyMQfM |
| The phone number of the customer who has sent the message on WhatsApp, number is in E.164 format | 918x98xx21x4 |
| The type of message received from the end user. Depending on 'type', the relevant message object will be received as part of the payload. Must be one of these: |
|
| The payload object contains the inbound message content sent by the customer | See types of incoming message received documentation below |
The sender object description
| Key | Description | Sample |
|---|---|---|
phone | The phone number of the end user who has sent the message on WhatsApp, number is in E.164 format | 918x98xx21x4 |
name | Name of the end user who has sent the message on WhatsApp | Daniel |
country_code | The sender's country code | 91 |
dial_code | The sender's dial code | 8x98xx21x4 |
The context object description
| Key | Description | Sample |
|---|---|---|
id | The unique WhatsApp message identifier for the inbound message | gBEGkYaYVSEEAgnPFrOLcjkFjL8 |
gsId | The unique Gupshup message identifier for the inbound message | 9b71295f-f7af-4c1f-b2b4-31b4a4867bad |
Updated 9 days ago
In the next chapter of this guide, you'll learn about different types of inbound messages, such as Text, media, interactive and other messages.
