Help Desk
  • Getting Started
    • ๐Ÿ™ŒWelcome to Whapi.Cloud
    • ๐Ÿ’ฐPricing
    • โ˜•Partners
    • ๐Ÿš€Getting started
    • ๐Ÿ‘จโ€๐Ÿ’ปAPI Docs
      • Developer hubs
      • Swagger environment
      • Postman collection
  • Sending
    • Introduction
    • Send text message
      • Whatsapp API send message PHP
      • Whatsapp API send message Python
      • Whatsapp API send message Node JS
      • Whatsapp API send message ะก#
      • Whatsapp API send message Java
      • API integration with VB6
      • Whatsapp API send message GO (Golang)
    • Send video, audio, image, document
      • How to send file from your local computer using the API
    • Send Group message
    • Send post to WhatsApp Channel
    • Send message with Buttons
    • Send Emoji
    • Overview of other methods for sending
      • Send Voice message
      • Send contact (vCard)
      • Send message reactions
  • Receiving
    • Introduction
    • Webhooks
      • Our webhooks (Tracked events)
      • Where to Find the Webhook URL?
      • Set the webhook link to the channel
      • Detailed webhook settings
      • How to check the webhook?
      • Incoming webhooks format
        • Incoming message
        • Sent message
        • Chats
          • How to Track Chat Labels via Webhook
        • Groups
        • Communities
        • Contacts
        • Account and device status
        • Other
          • Calls
          • Presences
          • Labels
          • Views of stories (statuses)
          • Story (status) from your contacts
      • Receive messages
        • Receive WhatsApp messages using PHP
        • Receive WhatsApp messages using Node js
        • Receive WhatsApp messages using Python
    • HTTP API
      • How to retrieve files
      • Retrieve a Specific User's Chat History
      • Get a full-size picture in the response
      • Get order items
      • Get a profile picture of a chat or user
    • File expiration period
  • Groups
    • Send Group message
      • Mentioning all participants in a WhatsApp group
    • Get list of group members
    • Add new member to Group
  • Channels
    • Send post to WhatsApp Channel
    • Get messages from Channels
    • Get votes from polls in the Channel
  • Communities
    • Introduction
    • Create a community
    • Add a member to a community
    • Send announcement
    • Get info on community participants
    • Add a group / Exclude a group from the community
  • Account
    • Setting "Auto Download"
    • Customizable Webhook Headers
    • How to find out the IP channel
    • How to Delete a Channel
    • Add Business Info to Invoice
  • Source code
    • WhatsApp ChatBot
      • WhatsApp Python Bot
      • WhatsApp PHP Bot
      • WhatsApp Node JS Bot
      • WhatsApp Java Bot
    • WhatsApp API Google Sheets
    • WhatsApp Phone Number Checker
    • Request Distributor (Balancer)
  • FAQ
    • Does WhatsApp API work with the phone turned off?
    • Chat ID. What is it and how to get it?
    • Why do I see status "pending" after sending message?
    • How to send a paragraph (line break)
    • Inactive Links in WhatsApp Messages
    • WhatsApp Text Formatting
    • Checking if the number has Whatsapp
    • Specifics of sending messages to numbers of different countries
    • Current status of Buttons on WhatsApp
    • Why aren't participants being added to the group?
  • Hints
    • Android Emulators
    • Virtual Numbers for WhatsApp
    • How to use polls as buttons?
    • How to check who blocked you in Whatsapp?
    • Setting up a WhatsApp proxy
  • Integrations
    • Make.com
      • Ready-Made Scenarios
        • WhatsApp & Whisper API: Voice-to-Text Integration
        • Automated WhatsApp Group Message Forwarding in Make.com
      • Request Scenario Setup
    • Pabbly Connect
    • Google Contacts
    • DialogFlow
    • n8n
  • Tools
    • WhatsApp Number Checker
    • Automatic warm-up module
    • WhatsApp Activity Safety Meter
    • Residential Proxies from Whapi.Cloud
  • Troubleshooting
    • Couldn't Link Device โ€“ WhatsApp QR Code or Pairing Code Fails
    • Channel status โ€œSYNC_ERRORโ€
    • Not getting a READ status on webhook
    • 429 (Too Many Requests) - Soft Ban
    • โ€œWaiting for this message. This may take a whileโ€ โ€“ WhatsApp Message Error
    • Missing push notifications after connecting to API
  • Blocking
    • How to not get Banned?
    • How to do mailings without the risk of being blocked?
    • If My Number Is Banned, Can It Be Restored?
    • Unlocking Your WhatsApp Number
    • Connecting a New WhatsApp Number After a Ban: Steps and Recommendations
    • Warming Up New Phone Numbers for WhatsApp API
  • Partner Documentation
    • Introduction
    • Partner Dashboard Overview
    • Partner Program Guidelines
      • Workflow: Step-by-Step
      • Billing for Partners
      • Allocating Days to Customer Channels: Best Practices & Guide
      • Interface for channel management
    • Partner Documentation
      • Channel creation
      • Changing channel mode
      • Channel extension
      • Channel deletion
      • Getting the list of channels
      • Notices of end of days on balance
Powered by GitBook
On this page
  • Sending a poll
  • Tracking a user's selection in a poll
  • Node.Js source code

Was this helpful?

  1. Hints

How to use polls as buttons?

Creating polls as an alternative to interactive buttons in WhatsApp

PreviousVirtual Numbers for WhatsAppNextHow to check who blocked you in Whatsapp?

Last updated 8 months ago

Was this helpful?

Interactive buttons in WhatsApp are a very handy tool for working with customers.

In our API, you have the option to send messages with buttons:

However, sometimes buttons may not fit in your scenario. That's why we offer you a convenient alternative - use polls as buttons.

For the user, polls and interactive buttons are functionally similar. And the mechanism of working with a poll is very similar to that of buttons.

To work with surveys, you will need to use the method. You can find out more about it and test it here:

You will find ready-made code snippets in popular programming languages at the link.

Sending a poll

Sending a poll is quite easy, you need a few parameters in the body of the request:

  • title - here specify the full message to the conversation partner, the text of your question.

  • options - specify the user's response options. There can be from 2 to 12 of them.

  • count - this parameter affects the amount of response options from the conversation partner. For example, several or only one answer from the whole survey.

import requests

url = "https://gate.whapi.cloud/messages/poll"

payload = {
    "options": ["Eyelash extensions", "Eyebrow correction and coloring", "Massage", "I'm fine with everything!"],
    "title": "Thank you for visiting the Etteri salon! We are interested in ensuring that our beauty salon meets all your wishes. What service do you think is missing in our beauty salon?",
    "count": 1
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer YPZapY69pl9j0xQpxoMqqsKMoBat1p8h"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

Tracking a user's selection in a poll

Polls are of a customized type"type": "poll". At the same time, each option that can be voted for by the client also has its own identifier. For example:

"results": [
          {
            "name": "I'm good",
            "voters": [],
            "count": 0,
            "id": "YCUAzJ4pYtRgSP+k/udEwRdvHxxuRQmNCrdTKz/K2TU="
          },
          {
            "name": "Can't complain",
            "voters": [],
            "count": 0,
            "id": "f61LjJqD6KEefNsuDQrvFXAB1iufPN3U1ykIOxD8DRc="
          }
        ]

Whereas when you vote, the webhook will receive full details of the selected option in the poll.

{
 "id": "f61LjJqD6KEefNsuDQrvFXAB1iufPN3U1ykIOxD8DRc=",
 "name": "Can't complain",
 "count": 1,
 "voters": [
    "61399176983@s.whatsapp.net"
  ]
 }

This way, you will be able to handle your customers' responses and respond appropriately. For example, responding with a pre-prepared answer.

Node.Js source code

We have prepared a simple and easy to understand source code for you to implement in your survey response integration or bot.

Remember, if you have any questions or issues along the way, our support team is always here to help. We value every user and strive to ensure that your experience with our API is as smooth and efficient as possible.

to - in this parameter specify the of the recipient (group, or personal number) to whom we send the survey. (Send only numbers, without formatting or masks).

Example of a message sent to a customer
Chat ID
Read more
POST /messages/poll
๐Ÿ“Š Send poll messageWhapi Cloud - Whatsapp API for developers
In this method, you can send poll-type messages
Whapi-Cloud/whatsapp-api-send-poll-exampleGitHub
Logo
Logo