Skip to content

Incoming poll update message#

This section describes messageData object incoming webhook format for incoming poll update 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 = pollUpdateMessage

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

    • If you select an option in a poll, then immediately cancel it, the pollUpdateMessage webhook will be sent for the last state of the poll.
    • If you select an option in a poll, then cancel it a second or more later, the pollUpdateMessage webhook will be sent for both states of the poll.

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 pollUpdateMessage.
pollMessageData object Poll message data object

pollMessageData object parameters

Parameter Type Description
stanzaId string Poll message id
name string Poll name
votes array Array of poll options
multipleAnswers boolean Allow multiple answers. true - enabled, false - disabled, default: false

votes array parameters

Parameter Type Description
optionName string Option name
optionVoters array Array of wid users who selected the option

optionVoters array parameters

Parameter Type Description
default string wid user who selected the option

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": "pollUpdateMessage",
    "pollMessageData": {
      "stanzaId": "BAE53AFDD5F0C000",
      "name": "Poll Name",
      "votes": [
        {
          "optionName": "Variant 1",
          "optionVoters": []
        },
        {
          "optionName": "Variant 2",
          "optionVoters": ["79001234568@c.us"]
        }
      ],
      "multipleAnswers": false
    }
  }
}

Incoming poll update message from group chat webhook body example#

{
    "typeWebhook": "incomingMessageReceived",
    "instanceData": {
        "idInstance": 1234,
        "wid": "11001234567@c.us",
        "typeInstance": "whatsapp"
    },
    "timestamp": 1732268220,
    "idMessage": "2D9D6721A977D369246509EBE0CE44CA",
    "senderData": {
      "chatId": "120363369140947676@g.us",
      "chatName": "Group",
      "sender": "79001234568@c.us",
      "senderName": "John",
      "senderContactName": "John Doe"
  },
  "messageData": {
    "typeMessage": "pollUpdateMessage",
    "pollMessageData": {
      "stanzaId": "BAE53AFDD5F0C000",
      "name": "Poll Name",
      "votes": [
        {
          "optionName": "Variant 1",
          "optionVoters": []
        },
        {
          "optionName": "Variant 2",
          "optionVoters": ["79001234568@c.us"]
        }
      ],
      "multipleAnswers": false
    }
  }
}