Skip to content

Incoming poll message#

This section describes messageData object incoming webhook format for incoming poll message. 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 = pollMessage

Configuring an instance

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

  1. Through console enable the settings Get notifications about incoming messages and files and Get notifications about surveys

  2. Through the SetSettings method enable the settings incomingWebhook and pollMessageWebhook

Webhook#

Webhook parameters#

messageData object parameters

Parameter Type Description
typeMessage string Incoming message type. For messages of this type the parameter takes on the value pollMessage.
pollMessageData object Poll message data object

pollMessageData object parameters

Parameter Type Description
name string Poll name
options array Array of poll options
multipleAnswers boolean Allow multiple answers. true - enable, false - disable, default: false

options array parameters

Parameter Type Description
optionName string Option name

Webhook body example#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 1234,
    "wid": "11001234567@c.us",
    "typeInstance": "whatsapp"
  },
  "timestamp": 1588091580,
  "idMessage": "F7AEC1B7086ECDC7E6E45923F5EDB825",
  "senderData": {
    "chatId": "79001234568@c.us",
    "sender": "79001234568@c.us",
      "chatName": "John",
    "senderName": "John",
    "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "pollMessage",
    "pollMessageData": {
      "name": "Poll Name",
      "options": [
        {
          "optionName": "Variant 1"
        },
        {
          "optionName": "Variant 2"
        }
      ],
      "multipleAnswers": false
    }
  }
}