Incoming message with interactive buttons reply#
Beta version
The functionality is in beta mode. Functions can be changed and may also work unstably.
This section describes messageData
object incoming webhook format for incoming message with interactive buttons. For a description of the general format of incoming webhooks, refer to Incoming messages section.
To get incoming webhooks of this type, two conditions must be true:
typeWebhook
= incomingMessageReceived
messageData.typeMessage
= interactiveButtonsReply
Configuring an instance
To receive incoming notifications about text messages, you need to enable the settings using one of the following options:
-
Through console enable the setting
Get notifications about incoming messages and files
-
Through the SetSettings method enable the setting
incomingWebhook
Webhook#
Webhook parameters#
messageData
object parameters
Parameter | Type | Description |
---|---|---|
typeMessage | string | Received message type. For messages of this type, the parameter takes on the value interactiveButtonReply |
interactiveButtonsReply | object | Data object with buttons. |
interactiveButtons
object parameters
Parameter | Type | Description |
---|---|---|
header | string | Message title |
body | string | Message text. Emoji symbols are supported 😃 |
footer | string | Message footer. Convenient for visually highlighting text that relates to buttons |
buttons | array | Message buttons |
buttons
array parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
type | string | Yes | The type of message to send. There are 3 types: copy , call , and url |
buttonId | string | Yes | Button ID |
buttonText | string | Yes | Text on the button |
copyCode | string | No | Field for a button of the COPY type, is the value to copy when the button is clicked |
phoneNumber | string | No | Field for a button of the CALL type, the phone number to which a call will be made when the button is clicked |
url | string | No | Field for a button of the URL type, the link to which a transition will be made when the button is clicked |
Request body example#
{
"typeWebhook": "incomingMessageReceived",
"instanceData": {
"idInstance": 9903183012,
"wid": "79309995241@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1749560558,
"idMessage": "BAE5A7BA6D6E28EB",
"senderData": {
"chatId": "79309995304@c.us",
"chatName": "я тест",
"sender": "79309995304@c.us",
"senderName": "я тест",
"senderContactName": "я тест"
},
"messageData": {
"typeMessage": "interactiveButtonsReply",
"interactiveButtonsReply": {
"titleText": "Header text",
"contentText": "I use Green-API to send this message to you!",
"footerText": "Footer text",
"buttons": [
{
"type": "reply",
"buttonId": "1",
"buttonText": "First Button"
},
{
"type": "reply",
"buttonId": "2",
"buttonText": "Second Button"
},
{
"type": "reply",
"buttonId": "3",
"buttonText": "Third Button"
}
]
}
}
}
Example of a notification body with a button pressed#
{
"typeWebhook": "incomingMessageReceived",
"instanceData": {
"idInstance": 9903183013,
"wid": "79309995304@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1749562001,
"idMessage": "C0CD39BB261589D5C98412D255CD000B",
"senderData": {
"chatId": "79309995241@c.us",
"chatName": "<><>SWE999Check&8-",
"sender": "79309995241@c.us",
"senderName": "<><>SWE999Check&8-",
"senderContactName": "<><>SWE999Check&8-"
},
"messageData": {
"typeMessage": "templateButtonsReplyMessage",
"templateButtonReplyMessage": {
"stanzaId": "BAE5A7BA6D6E28EB",
"selectedIndex": 0,
"selectedId": "1",
"selectedDisplayText": "First Button"
}
}
}