Send a poll to one or many phone numbers on WhatsApp.
http://HOST:PORT/pollSend a JSON body.
| Parameter | Required | Description |
recipient |
YES | A list of the phone numbers to send the poll to. |
question |
YES | The question you want to ask. |
options |
YES | A list of the answers people can choose from. |
password |
YES | The password for your WhatsApp app. Ask us for it. |
curl --location --request POST 'http://HOST:PORT/poll' \
--header 'Content-Type: application/json' \
--data '{
"recipient": [
"265884113450",
"265992026866"
],
"question": "Question which you wanted ask",
"options": [
"Option 1",
"Option 2"
],
"password": "YOUR_PASSWORD"
}'
curl --location --request POST "http://HOST:PORT/poll" ^
--header "Content-Type: application/json" ^
--data "{\"recipient\":[\"265884113450\",\"265992026866\"],\"question\":\"Question which you wanted ask\",\"options\":[\"Option 1\",\"Option 2\"],\"password\":\"YOUR_PASSWORD\"}"
<?php
$headers = [
'Content-Type: application/json',
];
$data = [
'recipient' => [
'265884113450',
'265992026866'
],
'question' => 'Question which you wanted ask',
'options' => [
'Option 1',
'Option 2'
],
'password' => 'YOUR_PASSWORD'
];
$ch = curl_init('http://HOST:PORT/poll');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
const axios = require('axios');
axios.request({
method: 'post',
url: 'http://HOST:PORT/poll',
headers: {
'Content-Type': 'application/json'
},
data: {
"recipient": [
"265884113450",
"265992026866"
],
"question": "Question which you wanted ask",
"options": [
"Option 1",
"Option 2"
],
"password": "YOUR_PASSWORD"
}
}).then((res) => console.log(res.data))
.catch((err) => console.error(err.response ? err.response.data : err.message));
import requests
headers = {
'Content-Type': 'application/json'
}
payload = {
'recipient': [
'265884113450',
'265992026866'
],
'question': 'Question which you wanted ask',
'options': [
'Option 1',
'Option 2'
],
'password': 'YOUR_PASSWORD'
}
response = requests.request('POST', 'http://HOST:PORT/poll', headers=headers, json=payload)
print(response.json())
The response is JSON.
{
"success": true,
"message": "Poll sending completed",
"sent": 2,
"failed": 0,
"results": [
{
"recipient": "265884113450",
"status": "success"
},
{
"recipient": "265992026866",
"status": "success"
}
]
}