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:
to - in this parameter specify the Chat ID of the recipient (group, or personal number) to whom we send the survey. (Send only numbers, without formatting or masks).
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, and they must be unique and not duplicated.
count - this parameter affects the amount of response options from the conversation partner. For example, several or only one answer from the whole survey.
Example of a message sent to a customer
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:
Whereas when you vote, the webhook will receive full details of the selected option in the poll.
This way, you will be able to handle your customers' responses and respond appropriately. For example, responding with a pre-prepared answer.
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.
curl --request POST \
--url https://gate.whapi.cloud/messages/poll \
--header 'accept: application/json' \
--header 'authorization: Bearer YPZapY69pl9j0xQpxoMqqsKMoBat1p8h' \
--header 'content-type: application/json' \
--data
{
"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?",
"to": "[email protected]"
}
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?",
"to": "[email protected]"
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer YPZapY69pl9j0xQpxoMqqsKMoBat1p8h"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)