Send WhatsApp interactive messages

Conversations API provides the ability to our customer to send WhatsApp interactive messages.

Sending interactive message with quick reply

In order to send a WhatsApp interactive message, you must perform the following HTTP request to Conversations API. The following example uses the endpoint POST /v1/send, however, you can also use the other endpoints for sending messages, please check the Conversations API reference for details about the request.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H 'Authorization: AccessKey <access-key>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"content": {
"interactive": {
"type": "button",
"header": {
"type": "image",
"image": {
"url": "url"
}
},
"body": {
"text": "Do you like this t shirt?"
},
"action": {
"buttons": [
{
"id": "yes-unique-id",
"type": "reply",
"title": "Yes"
},
{
"id": "no-unique-id",
"type": "reply",
"title": "No"
}
]
},
"footer": {
"text": "We have this one in other colors."
}
}
},
"to": "+9999999999",
"type": "interactive",
"from": "0181d0bb76c54g9aae4309s822d35ba5"
}'
  • to is the phone number of the recipient
  • type must be interactive
  • from must be your WhatsApp channel ID

The HTTP response should be 202 Accepted and it should contain the message ID.

{
"id": "4a968dd619f54d9582440d15aaa791ec"
}

Receiving interactive message reply on quick reply

{
"id": "25f6585e4b4f42cbb43e8d1eafa8f999",
"conversationId": "df59ede508c7404d8d495c1172d79888",
"platform": "whatsapp",
"to": "+9999999990",
"from": "+9999999999",
"channelId": "0181d0bb76c54g9aae4309s822d35ba5",
"type": "interactive",
"content": {
"interactive": {
"type": "button_reply",
"reply": {
"id": "yes-unique-id",
"text": "Yes"
}
}
},
"direction": "received",
"status": "received",
"createdDatetime": "2021-09-15T08:53:43Z",
"updatedDatetime": "2021-09-15T08:53:45.220967583Z"
}

Sending interactive message with list messages

In order to send a WhatsApp interactive message using, you must perform the following HTTP request to Conversations API. The following example uses the endpoint POST /v1/send, however, you can also use the other endpoints for sending messages, please check the Conversations API reference for details about the request.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H 'Authorization: AccessKey <your-access-key>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"content": {
"interactive": {
"type": "list",
"header": {
"type": "text",
"text": "What you would like to do buy today?"
},
"body": {
"text": "To begin, tap Main Menu and choose from one of the following actions"
},
"action": {
"button": "Main Menu",
"sections": [
{
"title": "content-title-here",
"rows": [
{
"id": "unique-row-identifier-1",
"title": "Buy bundles"
}
]
},
{
"title": "content-title-here",
"rows": [
{
"id": "unique-row-identifier-2",
"title": "Buy airtime",
"description": "optional description"
}
]
}
]
}
}
},
"to": "+9999999999",
"type": "interactive",
"from": "0181d0bb76c54g9aae4309s822d35ba5"
}'
  • to is the phone number of the recipient
  • type must be interactive
  • from must be your WhatsApp channel ID

The HTTP response should be 202 Accepted and it should contain the message ID.

{
"id": "4a968dd619f54d9582440d15aaa791ec"
}

Receiving interactive message reply on list messages

{
"id": "e8c1bb83072a463cb7415d1523eeb889",
"conversationId": "df59ede508c7404d8d495c1172d79888",
"platform": "whatsapp",
"to": "+9999999990",
"from": "+9999999999",
"channelId": "0181d0bb76c54g9aae4309s822d35ba5",
"type": "interactive",
"content": {
"interactive": {
"type": "list_reply",
"reply": {
"id": "id2",
"text": "Buy airtime",
"description": "THIS IS DESCRIPTION"
}
}
},
"direction": "received",
"status": "received",
"createdDatetime": "2021-09-15T08:56:14Z",
"updatedDatetime": "2021-09-15T08:56:15.250899453Z"
}

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings