SendInteractiveButtons#
The method is designed to send a message with buttons to personal chats. The method sends buttons to transmit information like links and a phone number to call.
Beta version
The functionality is in beta mode. Functions can be changed and may also work unstably.
Request#
To send a message with buttons to personal chats, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/sendInteractiveButtons/{{apiTokenInstance}}
For apiUrl
, idInstance
and apiTokenInstance
request parameters, refer to Before you start section.
Features when working with buttons#
- The button name can have no more than 25 characters.
- There can be no more than 3 buttons in one message.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
chatId | string | Yes | Chat Id |
header | string | No | Message title |
body | string | Yes | Message text. Emoji symbols are supported 😃 |
footer | string | No | Message footer. Convenient for visually highlighting text that relates to buttons |
buttons | array | Yes | 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 . COPY - allows you to quickly copy the contents of the button. CALL - allows you to start a call by pressing the button. URL - allows you to open a link by pressing the button. |
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#
Sending a message to a personal chat:
{
"chatId": "79876543210@c.us",
"header": "Header",
"body": "Body",
"footer": "Footer",
"buttons": [
{
"type": "copy",
"buttonId": "1",
"buttonText": "Copy me",
"copyCode": "3333"
},
{
"type": "call",
"buttonId": "2",
"buttonText": "Call me",
"phoneNumber": "79329843267"
},
{
"type": "url",
"buttonId": "3",
"buttonText": "Green-api",
"url": "https://green-api.com"
}
]
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
idMessage | string | Outgoing message Id |
Response body example#
{
"idMessage": "3EB0C767D097B7C7C030"
}
Example of display at the recipient#
SendInteractiveButtons errors#
For a list of errors common to all methods, refer to Common errors section
Request examples#
curl --location --request POST '{{apiUrl}}/waInstance{{idInstance}}/sendInteractiveButtons/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "79876543210@c.us",
"header": "Header",
"body": "Body",
"footer": "Footer",
"buttons": [
{
"type": "copy",
"buttonId": "1",
"buttonText": "Copy me",
"copyCode": "3333"
},
{
"type": "call",
"buttonId": "2",
"buttonText": "Call me",
"phoneNumber": "79329843267"
},
{
"type": "url",
"buttonId": "3",
"buttonText": "Green-api",
"url": "https://green-api.com"
}
]
}'