Incoming Messages
In this section, you will be acquainted with receiving messages / inbound flow over WhatsApp.
Since WhatsApp is used for 2-way communication (chat), it is important to also implement an Inbound flow. You may configure webhook URLs for receiving the incoming message or delivery reports of the outgoing message. Unifonic's conversation platform allows you to configure multiple webhook URLs .
Configuring Webhook URLs
- Navigate to the Channels > WhatsApp.
- Click the Edit button, and navigate to the WEBHOOK tab.
- Click ADD NEW to paste the webhook URL on which the user would like to receive the incoming webhook responses for received messages
Sample: Received Message from a Quick Reply Button
{
"messageId": "4ac6890b-1756-4d6d-XXXXXXXXXXXXXXX",
"eventId": "23d47231-XXXX-4371-bf3c-XXXXXXXXX",
"eventType": "message.received",
"applicationId": "5dXXXXee-2da0-XXXX-82c1-7245XXXXXXXXX",
"parentMessageId": "278XXXX-663b-4bXX-97dc-295XXXXXd9XX",
"conversationId": "dcXXcf75-XXXX-4701-9cXb-3ee0XXXXXXX6",
"sender": {
"channel": "whatsapp",
"contact": "+966XXXXXXXX",
"name": "XXXXXX"
},
"content": {
"text": "Attending",
"type": "option",
"attachments": [
{
"type": "option",
"option": {
"text": "Attending",
"value": "test replies|"
}
}
]
},
"timestamp": "2023-05-02T11:33:20.000Z",
"receivedAt": "2023-05-02T11:33:21.092Z"
}
Sample: Received Message with Free Text
{
"messageId": "4ac6890b-1756-4d6d-XXXXXXXXXXXXXXX",
"eventId": "23d47231-XXXX-4371-bf3c-XXXXXXXXX",
"eventType": "message.received",
"applicationId": "5dXXXXee-2da0-XXXX-82c1-7245XXXXXXXXX",
"parentMessageId": "278XXXX-663b-4bXX-97dc-295XXXXXd9XX",
"conversationId": "dcXXcf75-XXXX-4701-9cXb-3ee0XXXXXXX6",
"sender": {
"channel": "whatsapp",
"contact": "+966XXXXXXXX",
"name": "XXXXXX"
},
"content": {
"text": "Hello",
"type": "text"
},
"timestamp": "2023-05-02T11:36:48.000Z",
"receivedAt": "2023-05-02T11:36:48.768Z"
}
Sample: Received Message with Image
{
"messageId": "4ac6890b-1756-4d6d-XXXXXXXXXXXXXXX",
"eventId": "23d47231-XXXX-4371-bf3c-XXXXXXXXX",
"eventType": "message.received",
"applicationId": "5dXXXXee-2da0-XXXX-82c1-7245XXXXXXXXX",
"parentMessageId": "278XXXX-663b-4bXX-97dc-295XXXXXd9XX",
"conversationId": "dcXXcf75-XXXX-4701-9cXb-3ee0XXXXXXX6",
"sender": {
"channel": "whatsapp",
"contact": "+966XXXXXXXX",
"name": "XXXXXX"
},
"content": {
"type": "image",
"image": {
"file": "/usr/local/wamedia/shared/b1cf38-8734-4ad3-b4a1-ef0c10d0d683",
"id": "b1c68f38-8734-4ad3-b4a1-ef0c10d683",
"mime_type": "image/jpeg",
"sha256": "29ed500fa64eb55fc19dc4124acb300e5dcc54a0f822a301ae99944db",
"caption": "Check out my new phone!"
}
},
"timestamp": "2023-05-02T11:36:48.000Z",
"receivedAt": "2023-05-02T11:36:48.768Z"
}
Sample: Received Message with Document
{
"messageId": "4ac6890b-1756-4d6d-XXXXXXXXXXXXXXX",
"eventId": "23d47231-XXXX-4371-bf3c-XXXXXXXXX",
"eventType": "message.received",
"applicationId": "5dXXXXee-2da0-XXXX-82c1-7245XXXXXXXXX",
"parentMessageId": "278XXXX-663b-4bXX-97dc-295XXXXXd9XX",
"conversationId": "dcXXcf75-XXXX-4701-9cXb-3ee0XXXXXXX6",
"sender": {
"channel": "whatsapp",
"contact": "+966XXXXXXXX",
"name": "XXXXXX"
},
"content": {
"type": "document",
"document": {
"caption": "80skaraokesonglistartist",
"file": "/usr/local/wamedia/shared/fc233119-733f-49c-bcbd-b2f68f798e33?fileExtension=pdf",
"id": "fc233119-733f-49c-bcbd-b2f68f798e33",
"mime_type": "application/pdf",
"sha256": "3b11fa6ef2bde1dd14726e09d3edaf782120919d06f6484f32d5d5caa4b8e"
}
},
"timestamp": "2023-05-02T11:36:48.000Z",
"receivedAt": "2023-05-02T11:36:48.768Z"
File extension provided
In order for customers to download files that are applicable, we have provided the file extension in the URL
Sample: Received Message with Audio Note/File
{
"messageId": "4ac6890b-1756-4d6d-XXXXXXXXXXXXXXX",
"eventId": "23d47231-XXXX-4371-bf3c-XXXXXXXXX",
"eventType": "message.received",
"applicationId": "5dXXXXee-2da0-XXXX-82c1-7245XXXXXXXXX",
"parentMessageId": "278XXXX-663b-4bXX-97dc-295XXXXXd9XX",
"conversationId": "dcXXcf75-XXXX-4701-9cXb-3ee0XXXXXXX6",
"sender": {
"channel": "whatsapp",
"contact": "+966XXXXXXXX",
"name": "XXXXXX"
},
"content": {
"type": "audio",
"audio": {
"file": "/usr/local/wamedia/shared/463e/b7ec/ff4e4d9bb1101879cbd411b2",
"id": "463eb7ec-ff4e-4d9b-b110-1879cbd411b2",
"mime_type": "audio/ogg; codecs=opus",
"sha256": "fa9e1807d936b7cebe63654ea3a7912b1fa9479220258d823590521ef53b0710"}
}
},
"timestamp": "2023-05-02T11:36:48.000Z",
"receivedAt": "2023-05-02T11:36:48.768Z"
}
Sample: Received Message with Location
{
"messageId": "4ac6890b-1756-4d6d-XXXXXXXXXXXXXXX",
"eventId": "23d47231-XXXX-4371-bf3c-XXXXXXXXX",
"eventType": "message.received",
"applicationId": "5dXXXXee-2da0-XXXX-82c1-7245XXXXXXXXX",
"parentMessageId": "278XXXX-663b-4bXX-97dc-295XXXXXd9XX",
"conversationId": "dcXXcf75-XXXX-4701-9cXb-3ee0XXXXXXX6",
"sender": {
"channel": "whatsapp",
"contact": "+966XXXXXXXX",
"name": "XXXXXX"
},
"content": {
"type": "location",
"location": {
"latitude": 37.758056,
"longitude": -122.425332,
"name": "Facebook HQ",
"address": "Hacker Way"
} "sha256": "fa9e1807d936b7cebe63654ea3a7912b1fa9479220258d823590521ef53b0710"}
}
},
"timestamp": "2023-05-02T11:36:48.000Z",
"receivedAt": "2023-05-02T11:36:48.768Z"
}
Updated about 14 hours ago