Whats91
Developers

Send Whats91-specific free-form chat text messages inside the customer service window.

Chat Text

Summary

Send Whats91-specific free-form chat text messages inside the customer service window.

Prerequisites

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

Use POST /api/v2/chat for free-form text replies. If type is omitted and no media, buttons, or list payload is present, Whats91 treats the request as a text message.

POST/api/v2/chat
ParameterTypeRequiredDescription
senderIdstringOptionalRegistered WhatsApp sender number.
tostringRequiredRecipient phone number. Aliases: receiverId, receiver_id, receiver.
textstringRequiredMessage body text. Aliases: messageText, message_text, body, message.
typestringOptionalOptional. Defaults to text when omitted.
curl
curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "to": "918888888888",
    "messageText": "Your support ticket has been updated."
  }'
200 OK
{
  "success": true,
  "data": {
    "messageId": "wamid.xxxxx",
    "status": "sent",
    "receiverId": "918888888888"
  },
  "metadata": {
    "requestId": "request-uuid"
  }
}

If no text alias is supplied for a text request, Whats91 returns MISSING_TEXT.

SDK Examples

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

cURL
curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d 'curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "to": "918888888888",
    "messageText": "Your support ticket has been updated."
  }''
Node.js
const response = await fetch("https://graph.whats91.com/api/v2/chat", {
  method: "POST",
  headers: {
    "Authorization": "Bearer w91_live_xxx",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "to": "918888888888",
    "messageText": "Your support ticket has been updated."
  }')
});

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/chat");
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/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "to": "918888888888",
    "messageText": "Your support ticket has been updated."
  }')
]);

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

response = requests.request(
    "POST",
    "https://graph.whats91.com/api/v2/chat",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    },
    json=curl -X POST "https://graph.whats91.com/api/v2/chat" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "senderId": "919999999999",
    "to": "918888888888",
    "messageText": "Your support ticket has been updated."
  }'
)

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/chat");
request.Content = new StringContent(
  """curl -X POST \"https://graph.whats91.com/api/v2/chat\" \
  -H \"Authorization: Bearer w91_live_xxx\" \
  -H \"Content-Type: application/json\" \
  -d '{
    \"senderId\": \"919999999999\",
    \"to\": \"918888888888\",
    \"messageText\": \"Your support ticket has been updated.\"
  }'""",
  Encoding.UTF8,
  "application/json"
);

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

Related APIs