Skip to content

Outgoing message with interactive buttons#

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 outgoing message with interactive buttons. For a description of the general format of incoming webhooks, refer to Outgoing messages section.

To get incoming webhooks of this type, two conditions must be true:

typeWebhook = outgoingMessageReceived || outgoingAPIMessageReceived

messageData.typeMessage = interactiveButtons

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 interactiveButtons
interactiveButtons object Message with interactive buttonsdata 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#

Example of notification body of buttons sent by sendInteractiveButtons method#

{
    "type": "outgoing",
    "idMessage": "BAE53E7C37B3C05A",
    "timestamp": 1747817913,
    "typeMessage": "interactiveButtons",
    "chatId": "79581004388@c.us",
    "interactiveButtons": {
        "titleText": "Header",
        "contentText": "Body",
        "footerText": "Footer",
        "buttons": [
            {
                "type": "copy",
                "buttonId": "1",
                "buttonText": "Copy me",
                "copyCode": "3333",
                "phoneNumber": null,
                "url": null
            },
            {
                "type": "call",
                "buttonId": "2",
                "buttonText": "Call me",
                "copyCode": null,
                "phoneNumber": "79329843267",
                "url": null
            },
            {
                "type": "url",
                "buttonId": "3",
                "buttonText": "Green-api",
                "copyCode": null,
                "phoneNumber": null,
                "url": "https://green-api.com"
            }
        ]
    },
    "statusMessage": "sent",
    "sendByApi": true
}

Example of notification body of buttons sent by sendInteractiveButtons method{#webhook-example-sendInteractiveButtonsReply}#

{
    "type": "outgoing",
    "idMessage": "BAE57AF3BBAFE9D4",
    "timestamp": 1747819050,
    "typeMessage": "interactiveButtons",
    "chatId": "79581004388@c.us",
    "interactiveButtons": {
        "titleText": "Header",
        "contentText": "Body",
        "footerText": "Footer",
        "buttons": [
            {
                "type": "reply",
                "buttonId": "1",
                "buttonText": "First Button",
                "copyCode": null,
                "phoneNumber": null,
                "url": null
            },
            {
                "type": "reply",
                "buttonId": "2",
                "buttonText": "Second Button",
                "copyCode": null,
                "phoneNumber": null,
                "url": null
            },
            {
                "type": "reply",
                "buttonId": "3",
                "buttonText": "Third Button",
                "copyCode": null,
                "phoneNumber": null,
                "url": null
            }
        ]
    },
    "statusMessage": "delivered",
    "sendByApi": true
}