Get votes from polls in the Channel

Polls in the channel (newsletter) are a very handy feature, but there are pitfalls here

We already know how to send messages to WhatsApp channels, and itโ€™s incredibly convenient โ€” our API lets you fully automate channel management: receiving messages, tracking changes, sending messages, and managing administrators.

Unlike other messaging features, WhatsApp Channels donโ€™t show subscriber details. This means you canโ€™t see who voted in a poll or reacted to a post. In this article, weโ€™ll cover the special approach needed to get poll vote information from a channel and walk you through the process step by step.

How do I receive voting information?

Unfortunately, WhatsApp doesn't provide this information directly, so we had to implement additional operations to enable receiving callbacks for the โ€œvoted in pollโ€ event.

Before you can start receiving poll information from a channel, you need to subscribe to channel updates. This is done through a system endpoint, which allows you to receive poll-related callbacks.

To subscribe, use the POST method with the following endpoint: https://gate.whapi.cloud/newsletters/{NewsletterID}/tracking Make sure to specify the channel ID. Once this is completed and you receive a successful response, you will begin receiving poll vote data via your webhook.

Please note that there may be a delay of about 10-20 seconds in receiving these callbacks. The delay is not due to our API - that's how WhatsApp receives and updates information on its side.

Additionally, you can only follow one channel at a time. If you are managing multiple channels, this method will not apply to all of them at once. You will only monitor the last channel you have set up tracking.

To get a callback with this information, enable Messages PATCH mode in your webhook settings. Example of an incoming callback about a poll vote:

{
  "messages_updates": [
    {
      "id": "PrBkfK320oQnGA-xyYBq52rvzX1jA",
      "trigger": {
        "id": "QBg2URA-h.0Bq52rvzX1jA",
        "from_me": false,
        "type": "system",
        "chat_id": "120363120408037684@newsletter",
        "timestamp": 1726147478,
        "source": "mobile",
        "from": "120363120408037684"
      },
      "before_update": {
        "id": "PrBkfK320oQnGA-xyYBq52rvzX1jA",
        "from_me": true,
        "type": "poll",
        "chat_id": "120363120408037684@newsletter",
        "timestamp": 1726146434,
        "source": "mobile",
        "poll": {
          "title": "Hello?!",
          "options": [
            "Option 1 ๐Ÿค ",
            "Option 2 ๐Ÿ˜ถ\u200d๐ŸŒซ๏ธ"
          ],
          "total": 3,
          "results": [
            {
              "name": "Option 1 ๐Ÿค ",
              "voters": [],
              "count": 2,
              "id": "gOzELIQY54NHHytJw6c9Io4fEeuwRiJDno98Th9I7kg="
            },
            {
              "name": "Option 2 ๐Ÿ˜ถ\u200d๐ŸŒซ๏ธ",
              "voters": [],
              "count": 1,
              "id": "0IjOIbIci9QaHswHH5FbS24L7t1c560gceoM5hov6oY="
            }
          ]
        },
        "from": "919984351847"
      },
      "after_update": {
        "id": "PrBkfK320oQnGA-xyYBq52rvzX1jA",
        "from_me": true,
        "type": "poll",
        "chat_id": "120363120408037684@newsletter",
        "timestamp": 1726146434,
        "source": "mobile",
        "poll": {
          "title": "Hello?!",
          "options": [
            "Option 1 ๐Ÿค ",
            "Option 2 ๐Ÿ˜ถ\u200d๐ŸŒซ๏ธ"
          ],
          "total": 4,
          "results": [
            {
              "name": "Option 1 ๐Ÿค ",
              "voters": [],
              "count": 3,
              "id": "gOzELIQY54NHHytJw6c9Io4fEeuwRiJDno98Th9I7kg="
            },
            {
              "name": "Option 2 ๐Ÿ˜ถ\u200d๐ŸŒซ๏ธ",
              "voters": [],
              "count": 1,
              "id": "0IjOIbIci9QaHswHH5FbS24L7t1c560gceoM5hov6oY="
            }
          ]
        },
        "from": "919984351847"
      },
      "changes": [
        "poll"
      ]
    }
  ],
  "event": {
    "type": "messages",
    "event": "patch"
  },
  "channel_id": "MANTIS-PF238"
}

If you want to get vote information via HTTP request, you will also need to be subscribed for updates on the channel.

Use the GET endpoint https://gate.whapi.cloud/newsletters/{NewsletterID}/messages to retrieve all messages from the WhatsApp channel. Find your poll in the reponse and you will see the amount of votes in the poll.

The method returns the history of WhatsApp Channel messages. Search by ID for your poll post to see the votes.

Warning. Get this information via GET https://gate.whapi.cloud/messages/{MessageID} unfortunately will not work. This is due to the nature of getting votes from a poll in a channel, where we perform additional operations that do not affect the Messages section.

We continue to explore WhatsApp's capabilities and add to our methods for automation.

If you have any questions, our team is always available to help you.

Last updated