Send polls

Legacy APIs - WhatsApp
Legacy WhatsApp API We only offer this type of WhatsApp API to customers who specifically request it. We have now moved to the official WhatsApp. To use official WhatsApp, contact us on WhatsApp +265992026866.
Starting a new integration? This is a legacy API. It stays available for existing integrations, but new integrations should use the SMS V3 APIs.

Send a poll to one or many phone numbers on WhatsApp.

POSThttp://HOST:PORT/poll

Send a JSON body.

Parameters

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.

Example request

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())

Response

The response is JSON.

{
  "success": true,
  "message": "Poll sending completed",
  "sent": 2,
  "failed": 0,
  "results": [
    {
      "recipient": "265884113450",
      "status": "success"
    },
    {
      "recipient": "265992026866",
      "status": "success"
    }
  ]
}

Good to know

  • Your WhatsApp app has its own address (host and port), which we give you when the app is set up. Replace HOST:PORT with it.