Skip to content
Whats91

Send Meta-compatible payloads with the sender chosen from the URL path rather than the request body.

Explicit Sender Route

Summary

Send Meta-compatible payloads with the sender chosen from the URL path rather than the request body.

Prerequisites

  • Authorization: Bearer w91_live_xxx
  • Content-Type: application/json for JSON requests

This route behaves exactly like POST /api/v2/messages, except the sender comes from the URL path. It is the closest match to Meta Cloud API URL structure and the most explicit way to choose a sender, which makes it the best target when repointing an existing Cloud API client at Whats91.

POST/api/v2/{phoneNumberId}/messages

Send a Meta-compatible payload from an explicit sender.

ParameterTypeRequiredDescription
phoneNumberIdstringRequiredMeta WhatsApp Business phone-number ID of the sender.
messaging_productstringRequiredAlways whatsapp.
tostringRequiredRecipient WhatsApp number in international format.
typestringRequiredtext, image, video, audio, document, sticker, location, contacts, template, interactive, or reaction.
cURL
curl -X POST "https://graph.whats91.com/api/v2/1234567890/messages" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "918888888888",
    "type": "text",
    "text": { "body": "Hello" }
  }'
200 OK
{
  "messaging_product": "whatsapp",
  "contacts": [{ "input": "918888888888", "wa_id": "918888888888" }],
  "messages": [{ "id": "wamid.xxxxx" }]
}
  • Content-Type must be application/json. Multipart is not accepted on Meta-compatible routes.
  • Responses and errors use Meta shapes, not the Whats91 envelope.
  • A number-scoped token can only address its bound sender; another phoneNumberId is rejected.
  • The X-Whats91-Request-Id header is still returned for correlation.

Tip

Prefer this route over POST /api/v2/messages when your system already tracks Meta phone number IDs. It removes any ambiguity about which sender a message goes out from.

SDK Examples

Use these examples as starting points for server-side implementations.

cURL
curl -X POST "https://graph.whats91.com/api/v2/{phoneNumberId}/messages" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "918888888888",
  "type": "text",
  "text": {
    "body": "Hello"
  }
}'
Node.js
const response = await fetch("https://graph.whats91.com/api/v2/{phoneNumberId}/messages", {
  method: "POST",
  headers: {
    "Authorization": "Bearer w91_live_xxx",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "918888888888",
    "type": "text",
    "text": {
      "body": "Hello"
    }
  })
});

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/{phoneNumberId}/messages");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer w91_live_xxx",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "messaging_product" => "whatsapp",
    "recipient_type" => "individual",
    "to" => "918888888888",
    "type" => "text",
    "text" => [
      "body" => "Hello"
    ]
  ])
]);

$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests

response = requests.request(
    "POST",
    "https://graph.whats91.com/api/v2/{phoneNumberId}/messages",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    },
    json={
        "messaging_product": "whatsapp",
        "recipient_type": "individual",
        "to": "918888888888",
        "type": "text",
        "text": {
            "body": "Hello"
        }
    }
)

print(response.json())
C#
using System.Text;

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer w91_live_xxx");

var request = new HttpRequestMessage(HttpMethod.Post, "https://graph.whats91.com/api/v2/{phoneNumberId}/messages");
request.Content = new StringContent(
  """
  {
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "918888888888",
    "type": "text",
    "text": {
      "body": "Hello"
    }
  }
  """,
  Encoding.UTF8,
  "application/json"
);

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Related APIs