Text response
Use response.type=text with response.text for plain message replies.
Create a chatbot with the generic public v2 endpoint by providing response.type.
Create a chatbot with the generic public v2 endpoint by providing response.type.
Endpoint: POST /api/v2/chatbots. This generic create API accepts the common chatbot fields and creates the response kind specified by response.type. Use the specialized text, media, and interactive routes when you want stronger shape-specific validation.
Use response.type=text with response.text for plain message replies.
Use response.type=media with a public HTTPS media URL.
Use response.type=buttons, cta, or list for structured WhatsApp replies.
Public v2 chatbot creation creates a bot configuration and never sends a WhatsApp message directly.
/api/v2/chatbots| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | header | Required | Bearer w91_public_token_here. |
Content-Type | header | Required | Must be application/json for POST requests. |
authToken | string | Optional | Compatibility body token. auth_token and token are also accepted. |
senderId | string | Optional | WhatsApp sender number. Required for global tokens and optional for sender-bound tokens. |
chatbot.name | string | Required | Human-readable chatbot name. |
chatbot.trigger.type | string | Optional | contains, exact, starts_with, ends_with, contains_whole_word, regex, or welcome. |
chatbot.trigger.keywords | string[] | Optional | Keyword list. Required unless trigger.keyword is supplied. |
chatbot.trigger.keyword | string | Optional | Single keyword shortcut. Required unless trigger.keywords is supplied. |
chatbot.priority | number | Optional | Optional priority clamped between 0 and 255. |
chatbot.status | string | Optional | ACTIVE or INACTIVE. Omitted status defaults to ACTIVE. |
chatbot.response.type | string | Required | response.type decides whether the rule is text, media, buttons, cta, or list. |
curl -X POST "https://graph.whats91.com/api/v2/chatbots" \
-H "Authorization: Bearer w91_public_token_here" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"chatbot": {
"name": "General Help",
"trigger": {
"type": "contains",
"keywords": ["help", "support"]
},
"priority": 5,
"status": "ACTIVE",
"response": {
"type": "text",
"text": "How can we help you today?"
}
}
}'{
"success": true,
"message": "Chatbot created",
"data": {
"senderId": "916268662275",
"phoneNumberId": "1043189608869917",
"wabaId": "1605386820498470",
"chatbot": {
"chatbotUid": "bot_uid",
"uid": "bot_uid",
"name": "General Help",
"botType": "simple",
"triggerType": "contains",
"replyTrigger": "help, support",
"replyText": "How can we help you today?",
"status": 1
}
},
"metadata": {
"apiVersion": "v2",
"requestId": "request-uuid"
}
}| Field | Required | Notes |
|---|---|---|
| name | Yes | Required display name for the chatbot rule. |
| trigger.keywords | Conditional | Array of trigger words. Required unless trigger.keyword is present. |
| trigger.keyword | Conditional | Single trigger word. Required unless trigger.keywords is present. |
| trigger.type | No | contains, exact, starts_with, ends_with, contains_whole_word, regex, or welcome. |
| priority | No | Optional number clamped between 0 and 255. |
| status | No | ACTIVE or INACTIVE. Defaults to ACTIVE. |
| response.type | Yes | text, media, buttons, cta, or list. |
| HTTP | Error code | Scenario |
|---|---|---|
| 401 | MISSING_AUTH_TOKEN | No public API token supplied. |
| 401 | INVALID_AUTH_TOKEN | Token is invalid, expired, revoked, or not tied to an active customer. |
| 403 | SENDER_NOT_ALLOWED | Number-scoped token attempted another sender. |
| 403 | FEATURE_NOT_AVAILABLE | Customer subscription does not include chatbots. |
| 400 | MISSING_CHATBOT | Request body does not include chatbot. |
| 400 | VALIDATION_FAILED | Missing name, trigger, response text, button labels, list rows, invalid status, or invalid CTA URL. |
| 400 | WHATSAPP_SETUP_INCOMPLETE | Sender setup could not be resolved. |
| 415 | UNSUPPORTED_CONTENT_TYPE | POST request is not JSON. |
Warning
Store public API tokens server-side only. Do not place customer-specific secrets inside chatbot text, button labels, ctaUrl values, sections, or rows.
Use these examples as starting points for server-side implementations.
curl -X POST "https://graph.whats91.com/api/v2/chatbots" \
-H "Authorization: Bearer w91_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"senderId": "916268662275",
"chatbot": {
"name": "General Help",
"trigger": {
"type": "contains",
"keywords": [
"help",
"support"
]
},
"priority": 5,
"status": "ACTIVE",
"response": {
"type": "text",
"text": "How can we help you today?"
}
}
}'const response = await fetch("https://graph.whats91.com/api/v2/chatbots", {
method: "POST",
headers: {
"Authorization": "Bearer w91_live_xxx",
"Content-Type": "application/json"
},
body: JSON.stringify({
"senderId": "916268662275",
"chatbot": {
"name": "General Help",
"trigger": {
"type": "contains",
"keywords": [
"help",
"support"
]
},
"priority": 5,
"status": "ACTIVE",
"response": {
"type": "text",
"text": "How can we help you today?"
}
}
})
});
const data = await response.json();
console.log(data);$ch = curl_init("https://graph.whats91.com/api/v2/chatbots");
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([
"senderId" => "916268662275",
"chatbot" => [
"name" => "General Help",
"trigger" => [
"type" => "contains",
"keywords" => [
"help",
"support"
]
],
"priority" => 5,
"status" => "ACTIVE",
"response" => [
"type" => "text",
"text" => "How can we help you today?"
]
]
])
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;import requests
response = requests.request(
"POST",
"https://graph.whats91.com/api/v2/chatbots",
headers={
"Authorization": "Bearer w91_live_xxx",
"Content-Type": "application/json",
},
json={
"senderId": "916268662275",
"chatbot": {
"name": "General Help",
"trigger": {
"type": "contains",
"keywords": [
"help",
"support"
]
},
"priority": 5,
"status": "ACTIVE",
"response": {
"type": "text",
"text": "How can we help you today?"
}
}
}
)
print(response.json())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/chatbots");
request.Content = new StringContent(
"""
{
"senderId": "916268662275",
"chatbot": {
"name": "General Help",
"trigger": {
"type": "contains",
"keywords": [
"help",
"support"
]
},
"priority": 5,
"status": "ACTIVE",
"response": {
"type": "text",
"text": "How can we help you today?"
}
}
}
""",
Encoding.UTF8,
"application/json"
);
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());