Whats91
Developers

Send Meta-compatible text messages through the Whats91 public API.

Meta-Compatible Text

Summary

Send Meta-compatible text messages through the Whats91 public API.

Prerequisites

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

Send a text message with a Meta-style text object. The request body uses messaging_product, to, type, and text.body.

POST/api/v2/messages
ParameterTypeRequiredDescription
senderIdstringOptionalSender phone number for body-selected sends.
messaging_productstringRequiredMust be whatsapp.
tostringRequiredRecipient WhatsApp phone number.
typestringOptionalSet to text. Defaults to text when omitted.
text.bodystringRequiredMessage body text.
curl - body sender
curl -X POST "https://graph.whats91.com/api/v2/messages" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "messaging_product": "whatsapp",
    "to": "918888888888",
    "type": "text",
    "text": {
      "body": "Hello from a Meta-compatible payload"
    }
  }'
curl - path phoneNumberId
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",
    "to": "918888888888",
    "type": "text",
    "text": {
      "body": "Hello from a path-selected sender"
    }
  }'

SDK Examples

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

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

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/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(curl -X POST "https://graph.whats91.com/api/v2/messages" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "messaging_product": "whatsapp",
    "to": "918888888888",
    "type": "text",
    "text": {
      "body": "Hello from a Meta-compatible payload"
    }
  }')
]);

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

response = requests.request(
    "POST",
    "https://graph.whats91.com/api/v2/messages",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    },
    json=curl -X POST "https://graph.whats91.com/api/v2/messages" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "messaging_product": "whatsapp",
    "to": "918888888888",
    "type": "text",
    "text": {
      "body": "Hello from a Meta-compatible payload"
    }
  }'
)

print(response.json())
C#
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/messages");
request.Content = new StringContent(
  """curl -X POST \"https://graph.whats91.com/api/v2/messages\" \
  -H \"Authorization: Bearer w91_live_xxx\" \
  -H \"Content-Type: application/json\" \
  -d '{
    \"senderId\": \"919999999999\",
    \"messaging_product\": \"whatsapp\",
    \"to\": \"918888888888\",
    \"type\": \"text\",
    \"text\": {
      \"body\": \"Hello from a Meta-compatible payload\"
    }
  }'""",
  Encoding.UTF8,
  "application/json"
);

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

Related APIs