Send a message with a list of options to choose from on WhatsApp.
http://HOST:PORT/listSend a JSON body.
| Parameter | Required | Description |
recipient |
YES | The phone number to send to. |
bodyText |
YES | The text of the message, for example "How can we help you today?". |
buttonText |
YES | The text of the button that opens the list, for example "Select Service". |
sections |
YES | The sections of the list. Each section has a title and its rows. Each row has an id, a title and a description. |
footerText |
NO | A line shown at the bottom of the message. |
password |
YES | The password for your WhatsApp app. Ask us for it. |
curl --location --request POST 'http://HOST:PORT/list' \
--header 'Content-Type: application/json' \
--data '{
"recipient": "+265992026866",
"bodyText": "How can we help you today?",
"buttonText": "Select Service",
"sections": [
{
"title": "Customer Service",
"rows": [
{
"id": "1",
"title": "Support",
"description": "Get technical support"
},
{
"id": "2",
"title": "Sales",
"description": "Talk to sales team"
}
]
}
],
"footerText": "We'\''re here to help",
"password": "YOUR_PASSWORD"
}'
curl --location --request POST "http://HOST:PORT/list" ^
--header "Content-Type: application/json" ^
--data "{\"recipient\":\"+265992026866\",\"bodyText\":\"How can we help you today?\",\"buttonText\":\"Select Service\",\"sections\":[{\"title\":\"Customer Service\",\"rows\":[{\"id\":\"1\",\"title\":\"Support\",\"description\":\"Get technical support\"},{\"id\":\"2\",\"title\":\"Sales\",\"description\":\"Talk to sales team\"}]}],\"footerText\":\"We're here to help\",\"password\":\"YOUR_PASSWORD\"}"
<?php
$headers = [
'Content-Type: application/json',
];
$data = [
'recipient' => '+265992026866',
'bodyText' => 'How can we help you today?',
'buttonText' => 'Select Service',
'sections' => [
[
'title' => 'Customer Service',
'rows' => [
[
'id' => '1',
'title' => 'Support',
'description' => 'Get technical support'
],
[
'id' => '2',
'title' => 'Sales',
'description' => 'Talk to sales team'
]
]
]
],
'footerText' => 'We\'re here to help',
'password' => 'YOUR_PASSWORD'
];
$ch = curl_init('http://HOST:PORT/list');
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/list',
headers: {
'Content-Type': 'application/json'
},
data: {
"recipient": "+265992026866",
"bodyText": "How can we help you today?",
"buttonText": "Select Service",
"sections": [
{
"title": "Customer Service",
"rows": [
{
"id": "1",
"title": "Support",
"description": "Get technical support"
},
{
"id": "2",
"title": "Sales",
"description": "Talk to sales team"
}
]
}
],
"footerText": "We're here to help",
"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': '+265992026866',
'bodyText': 'How can we help you today?',
'buttonText': 'Select Service',
'sections': [
{
'title': 'Customer Service',
'rows': [
{
'id': '1',
'title': 'Support',
'description': 'Get technical support'
},
{
'id': '2',
'title': 'Sales',
'description': 'Talk to sales team'
}
]
}
],
'footerText': 'We\'re here to help',
'password': 'YOUR_PASSWORD'
}
response = requests.request('POST', 'http://HOST:PORT/list', 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"
}
]
}