Send many WhatsApp texts

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 several WhatsApp text messages in one request. Each item has its own recipient and message.

POSThttps://telcomw.com/api-v2/whatsapp/text

Send x-api-key and x-app-id as headers, and the messages as a JSON array in the body.

Parameters

Parameter Sent in Required Description
x-api-key header YES Your API key.
x-app-id header YES The id of your WhatsApp app.
[].recipient body YES The phone number to send to.
[].message body YES The message.

Example request

curl --location --request POST 'https://telcomw.com/api-v2/whatsapp/text' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'x-app-id: YOUR_APP_ID' \
  --header 'Content-Type: application/json' \
  --data '[
  {
    "recipient": "265992026866",
    "message": "message"
  },
  {
    "recipient": "265992026866",
    "message": "message 2"
  },
  {
    "recipient": "265884113450",
    "message": "message"
  }
]'
curl --location --request POST "https://telcomw.com/api-v2/whatsapp/text" ^
  --header "x-api-key: YOUR_API_KEY" ^
  --header "x-app-id: YOUR_APP_ID" ^
  --header "Content-Type: application/json" ^
  --data "[{\"recipient\":\"265992026866\",\"message\":\"message\"},{\"recipient\":\"265992026866\",\"message\":\"message 2\"},{\"recipient\":\"265884113450\",\"message\":\"message\"}]"
<?php

$headers = [
    'x-api-key: YOUR_API_KEY',
    'x-app-id: YOUR_APP_ID',
    'Content-Type: application/json',
];

$data = [
    [
        'recipient' => '265992026866',
        'message' => 'message'
    ],
    [
        'recipient' => '265992026866',
        'message' => 'message 2'
    ],
    [
        'recipient' => '265884113450',
        'message' => 'message'
    ]
];

$ch = curl_init('https://telcomw.com/api-v2/whatsapp/text');
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: 'https://telcomw.com/api-v2/whatsapp/text',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'x-app-id': 'YOUR_APP_ID',
    'Content-Type': 'application/json'
  },
  data: [
    {
      "recipient": "265992026866",
      "message": "message"
    },
    {
      "recipient": "265992026866",
      "message": "message 2"
    },
    {
      "recipient": "265884113450",
      "message": "message"
    }
  ]
}).then((res) => console.log(res.data))
  .catch((err) => console.error(err.response ? err.response.data : err.message));
import requests

headers = {
    'x-api-key': 'YOUR_API_KEY',
    'x-app-id': 'YOUR_APP_ID',
    'Content-Type': 'application/json'
}
payload = [
    {
        'recipient': '265992026866',
        'message': 'message'
    },
    {
        'recipient': '265992026866',
        'message': 'message 2'
    },
    {
        'recipient': '265884113450',
        'message': 'message'
    }
]

response = requests.request('POST', 'https://telcomw.com/api-v2/whatsapp/text', headers=headers, json=payload)
print(response.json())

Response

The response is JSON.

{
  "message": "Request to send messages was successful",
  "status": 200,
  "success": true,
  "data": [
    {
      "success": true,
      "message": "Message sent",
      "data": {
        "recipient": "265992026866",
        "message": "message"
      }
    },
    {
      "success": true,
      "message": "Message sent",
      "data": {
        "recipient": "265992026866",
        "message": "message 2"
      }
    },
    {
      "success": true,
      "message": "Message sent",
      "data": {
        "recipient": "265884113450",
        "message": "message"
      }
    }
  ]
}