Skip to content

Outgoing 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 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 = interactiveButtonsReply

Configuring an instance

To receive incoming notifications about text messages, you need to enable the settings using one of the following options:

  1. Through console enable the settings Get notifications about messages sent from API, Get notifications about messages sent from the phone

  2. Through the SetSettings method enable the settings outgoingAPIMessageWebhook and outgoingMessageWebhook

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#

{
  "typeWebhook": "outgoingAPIMessageReceived",
  "instanceData": {
    "idInstance": 9903183013,
    "wid": "79309995304@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1749560558,
  "idMessage": "BAE5A7BA6D6E28EB",
  "senderData": {
    "chatId": "79309995241@c.us",
    "chatName": "Ev",
    "sender": "79309995304@c.us",
    "senderName": "я тест",
    "senderContactName": "<><>SWE999Check&8-"
  },
  "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": "outgoingMessageReceived",
  "instanceData": {
    "idInstance": 9903183012,
    "wid": "79309995241@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1749562001,
  "idMessage": "C0CD39BB261589D5C98412D255CD000B",
  "senderData": {
    "chatId": "79309995304@c.us",
    "chatName": "79309995304",
    "sender": "79309995241@c.us",
    "senderName": "<><>SWE999Check&8-",
    "senderContactName": "я тест"
  },
  "messageData": {
    "typeMessage": "interactiveButtonsResponse",
    "interactiveButtonsResponse": {
      "stanzaId": "BAE5A7BA6D6E28EB",
      "selectedIndex": 0,
      "selectedId": "1",
      "selectedDisplayText": "First Button"
    }
  }
}