Skip to content

Incoming message with a poll#

This section describes the format of the incoming notification messageData object for an incoming poll message. For a description of the general format of incoming notifications, refer to the Incoming messages section.

To receive incoming notifications of this kind, two conditions must be met:

  • typeWebhook = incomingMessageReceived
  • messageData.typeMessage = pollMessage

Instance settings

To receive incoming notifications about messages with a poll, you need to enable the settings in one of the ways presented:

  1. Through the console, enable the Receive notifications about incoming messages and files and Receive notifications about polls settings

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

Notification#

Notification format#

Fields of the messageData object

Parameter Type Description
typeMessage string Type of the received message. For messages of this type the field takes the value pollMessage
pollMessageData object Object with data about the poll message

Fields of the pollMessageData object

Parameter Type Description
name string Poll name
options array Array of data about the poll answer options
multipleAnswers boolean Allow multiple answers. true — enabled, false — disabled. Default: false
forwardingScore integer Number of times the message has been forwarded
isForwarded boolean Whether the message is forwarded, takes the values true/false

Fields of the options array

Parameter Type Description
optionName string Answer option name

Notification body example#

{
  "typeWebhook": "incomingMessageReceived",
  "instanceData": {
    "idInstance": 4100000000,
    "wid": "79876543210@c.us",
    "typeInstance": "telegram"
  },
  "timestamp": 1732268220,
  "idMessage": "1763115112345",
  "senderData": {
    "chatId": "-10000000000000",
    "chatType": "channel",
    "chatName": "Faraway Kingdom",
    "sender": "1000000000",
    "senderName": "Ivan",
    "senderType": "user",
    "senderContactName": "Ivan Tsarevich"
  },
  "messageData": {
    "typeMessage": "pollMessage",
    "pollMessageData": {
      "name": "Poll Name",
      "options": [{ "optionName": "Variant 1" }, { "optionName": "Variant 2" }],
      "multipleAnswers": false,
      "forwardingScore": 0,
      "isForwarded": false
    }
  }
}