List WhatsApp templates through the API: names, status and a ready example request
The reference for the templates address of ArabyBot's API: what comes back with each template, the ready example request, picking the number, and the refusals.
On this page 7
The short answer
With a GET request to the templates address. The response returns the number's templates: each one's name, language, category, state at Meta and body text, and with each a ready example request with its fields and variables that you copy to the send address. The list is refreshed from Meta when you ask.
Also asked as: «اجيب قوالب الواتساب من الكود ازاي» · «قائمة قوالب واتساب api» · «list whatsapp templates api»
The address and authentication
GET https://app.arabybot.com/api/v1/templates
Send the send key in the header Authorization: Bearer abk_… or X-Api-Key. You create the key on the «Developer tools» page of the ArabyBot dashboard, and it is shown once when it is made. The call goes from your server, so never put the key in a page a visitor opens or in a mobile app.
The fields
from(optional) The number whose templates you want when the account has more than one; otherwise the default number.
An example request
cURL
curl https://app.arabybot.com/api/v1/templates \ -H "Authorization: Bearer abk_YOUR_KEY"
PHP
$ch = curl_init('https://app.arabybot.com/api/v1/templates');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer abk_YOUR_KEY'],
]);
$answer = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch); Python
import requests
r = requests.get(
'https://app.arabybot.com/api/v1/templates',
headers={
"Authorization": "Bearer abk_YOUR_KEY",
},
timeout=30,
)
print(r.status_code, r.json()) Node.js
// Node.js 18+
const r = await fetch('https://app.arabybot.com/api/v1/templates', {
headers: {"Authorization": "Bearer abk_YOUR_KEY"},
});
console.log(r.status, await r.json());
The response
200
{ "success": true, "templates": [
{ "name": "order_shipped", "language": "ar", "category": "UTILITY", "status": "APPROVED",
"body": "…",
"example": { "to": "966XXXXXXXX", "template": "order_shipped", "language": "ar", "variables": ["…", "…"] } }
] } statusis the template's state at Meta; a template can be sent when it isAPPROVED.exampleis a ready request body for this template: copy it to the template send address and put your values in.
The refusals
Every refusal comes back as JSON with "success": false, an error_code, and a message in Arabic in message and in English in message_en:
- 409
NO_NUMBER: No WhatsApp number is connected to the account, or the number infromis not one of its numbers. - 401
NO_KEY: The key was not sent in the header. - 401
INVALID_KEY: The key is wrong or was revoked; create one under «Developer tools». - 402
SUBSCRIPTION_EXPIRED: The account's subscription has ended. - 403
NOT_IN_PLAN: The account's plan does not include «Developer tools». - 429: The key passed 600 requests a minute; wait the time written in the
Retry-Afterheader. - 500
SERVER: A failure on our side; try again, and tell support if it repeats.
The limits
600 requests a minute per key. Whatever exceeds the pace WhatsApp accepts for your number waits in a queue, comes back with the status queued, then goes out by itself, so no message is lost. Meta's own limits on your number, how many people you may start conversations with in a day and the quality rating, stay as they are behind this API.
The full send API reference · All APIs for developers
Frequently asked questions
Can I create a new template from this API?
No. This address only reads templates. Creating a template and sending it to Meta's review is done from the ArabyBot dashboard.
Why does a template I just created not show?
The list is refreshed from Meta when you ask, so the template shows with its current state even while in review. If it does not show, check it is on the same number you are asking about.
Read next
Try the agent before you pay anything
The agent that will answer your customers is the one answering you now: ask it from the chat button here or on WhatsApp. Your account is free with no credit card, and the free trial on your own number or page is activated after you contact our team on customer-service WhatsApp.