The method is designed to send a message with buttons to a private or group chat
Button message functionality is currently provided on an 'as-is' basis due to its inherent instability and dependency on Meta's updates. Please be aware that with each new WhatsApp update, the behavior of button messages may change.
You can send a message with the button to either private chat or group chat. The buttons, e.g. YES / NO, can be selected by the user and used as a response to the sent message.
When the recipient clicks on a button, it automatically sends a reply to your message containing the buttonโs text. If you've set up a webhook for the channel, you'll receive a callback with both the button ID and the text.
Unfortunately, WhatsApp does not track the event of clicking these buttons. Therefore, it is not possible to get a webhook for pressing these buttons.
Message with list of options
curl --request POST \
--url https://gate.whapi.cloud/messages/interactive \
--header 'accept: application/json' \
--header 'authorization: Bearer {Your_Token}' \
--header 'content-type: application/json' \
--data '
{
"header": {
"text": "Header with text"
},
"body": {
"text": "Body message"
},
"footer": {
"text": "Footer message"
},
"action": {
"list": {
"sections": [
{
"title": "What's your favorite hamburger?",
"rows": [
{
"title": "Hamburger without cheese",
"id": "r1",
"description": "A burger without cheese or sauce is often referred to as a \"plain\" burger."
},
{
"id": "r2",
"title": "Cheeseburger",
"description": "A cheeseburger is a hamburger with a slice of melted cheese on top of the meat patty"
}
]
}
],
"label": "Pick a hamburger!"
}
},
"type": "list",
"to": "61371989950"
}
'
When the recipient clicks on a button, it automatically sends a reply to your message containing the buttonโs text. If you've set up a webhook for the channel, you'll receive a callback with both the button ID and the text.
{
"messages": [
{
"id": "A5y7S8JfMsgaYiXZC6Royw-gMoOS60TLw",
"from_me": false,
"type": "reply",
"chat_id": "61371989950@s.whatsapp.net",
"timestamp": 1726127469,
"source": "mobile",
"chat_name": "Jonathan Customer",
"reply": {
"type": "list_reply",
"list_reply": {
"id": "ListV3:",
"title": "",
"description": "A burger without cheese or sauce is often referred to as a \"plain\" burger."
}
},
"context": {
"quoted_id": "yqL1GxfdT7pX48I-wEASij1GoQ",
"quoted_author": "919984351847",
"quoted_content": {
"title": "Header with text",
"description": "Body message",
"label": "Pick a hamburger!",
"footer": "Footer message",
"sections": [
{
"title": "What's your favorite hamburger?",
"rows": [
{
"id": "ListV3:r1",
"title": "Hamburger without cheese",
"description": "A burger without cheese or sauce is often referred to as a \"plain\" burger."
},
{
"id": "ListV3:r2",
"title": "Cheeseburger",
"description": "A cheeseburger is a hamburger with a slice of melted cheese on top of the meat patty"
}
]
}
]
},
"quoted_type": "list"
},
"from": "61371989950",
"from_name": "Jonathan"
}
],
"event": {
"type": "messages",
"event": "post"
},
"channel_id": "MANTIS-PF238"
}
We continue to explore WhatsApp's capabilities and add to our methods for automation. In the upcoming updates we will have the ability to send messages with picture/media and buttons.
If you have any questions, our team is always available to help you.