Send buttons (list)

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 message with a list of options to choose from on WhatsApp.

POSThttp://HOST:PORT/list

Send a JSON body.

Parameters

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.

Example request

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

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.