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:
-
Through console enable the settings
Get notifications about incoming messages and files
andGet notifications about surveys
-
Through the SetSettings method enable the settings
incomingWebhook
andpollMessageWebhook
- 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.
- If you select an option in a poll, then immediately cancel it, the
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
}
}
}