Polls
Send polls and receive votes on WhatsApp with Wazend.
WhatsApp polls are a good alternative to buttons and other interactive messages. You can ask a question and offer options so the user can choose one or several, depending on the configuration.
Send poll
POST /api/sendPoll{
"session": "S0001",
"chatId": "5215551234567@c.us",
"poll": {
"name": "How are you?",
"options": ["Great!", "Good!", "Not so good"],
"multipleAnswers": false
}
}{
"id": "true_5215551234567@c.us_83ACBAAAAAAAAAAAAAAAAAAAA"
}Save the id field from the response to identify the poll when receiving votes.
Vote in a poll
POST /api/sendPollVote{
"chatId": "5215551234567@c.us",
"pollMessageId": "false_5215551234567@c.us_AAAAAAAAAAAAAAAAAAAA",
"pollServerId": null,
"votes": ["Great!"],
"session": "S0001"
}chatId— chat where the poll is.pollMessageId— ID of the poll message.votes— options you're voting for.
Events
You receive poll votes through the poll.vote and poll.vote.failed webhooks (identify your own with poll.fromMe). See the payload details in Events.