Appearance
Send Template Message
Send a pre-approved WhatsApp template (HSM) message. Templates are required when messaging a customer outside the 24-hour conversation window, or for the first message in a conversation.
POST /api/v1/messages/send-template
Request
http
POST /api/v1/messages/send-template HTTP/1.1
Authorization: Bearer wzy_your_key_here
Content-Type: application/jsonRequest body
json
{
"account_id": 1,
"to": "+201234567890",
"template_name": "order_shipped",
"language": "en_US",
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "John" },
{ "type": "text", "text": "ORD-9876" }
]
}
]
}| Field | Type | Required | Description |
|---|---|---|---|
account_id | integer | ✅ | The id from GET /accounts. |
to | string | ✅ | Recipient phone number in international format. |
template_name | string | ✅ | Exact name of an approved template in your Meta Business account. Max 200 chars. |
language | string | ✅ | Template language code, e.g. en_US, ar, fr. |
components | array | — | Variable values for the template. Follow Meta's component format. Omit for templates with no variables. |
Response
json
{
"success": true,
"message_id": "wamid.HBgLMjAxMjM0NTY3ODkVAgARGCA...",
"to": "201234567890"
}Examples
bash
curl -X POST https://whatsapp-backend.developnetwork.net/api/v1/messages/send-template \
-H "Authorization: Bearer wzy_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"account_id": 1,
"to": "+201234567890",
"template_name": "hello_world",
"language": "en_US"
}'bash
curl -X POST https://whatsapp-backend.developnetwork.net/api/v1/messages/send-template \
-H "Authorization: Bearer wzy_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"account_id": 1,
"to": "+201234567890",
"template_name": "order_shipped",
"language": "en_US",
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "John" },
{ "type": "text", "text": "ORD-9876" }
]
}
]
}'js
const res = await fetch('https://whatsapp-backend.developnetwork.net/api/v1/messages/send-template', {
method: 'POST',
headers: {
'Authorization': 'Bearer wzy_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
account_id: 1,
to: '+201234567890',
template_name: 'order_shipped',
language: 'en_US',
components: [
{
type: 'body',
parameters: [
{ type: 'text', text: 'John' },
{ type: 'text', text: 'ORD-9876' },
],
},
],
}),
})python
import requests
r = requests.post(
'https://whatsapp-backend.developnetwork.net/api/v1/messages/send-template',
headers={'Authorization': 'Bearer wzy_your_key_here'},
json={
'account_id': 1,
'to': '+201234567890',
'template_name': 'order_shipped',
'language': 'en_US',
'components': [
{
'type': 'body',
'parameters': [
{'type': 'text', 'text': 'John'},
{'type': 'text', 'text': 'ORD-9876'},
],
},
],
},
)
print(r.json())php
$ch = curl_init('https://whatsapp-backend.developnetwork.net/api/v1/messages/send-template');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer wzy_your_key_here',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 1,
'to' => '+201234567890',
'template_name' => 'order_shipped',
'language' => 'en_US',
'components' => [[
'type' => 'body',
'parameters' => [
['type' => 'text', 'text' => 'John'],
['type' => 'text', 'text' => 'ORD-9876'],
],
]],
]),
]);
echo curl_exec($ch);Component types
Templates can have multiple component sections. The most common are:
Body with text variables
json
{
"type": "body",
"parameters": [
{ "type": "text", "text": "value_for_{{1}}" },
{ "type": "text", "text": "value_for_{{2}}" }
]
}Header with an image
json
{
"type": "header",
"parameters": [
{
"type": "image",
"image": { "link": "https://example.com/banner.jpg" }
}
]
}Button (quick reply or URL)
json
{
"type": "button",
"sub_type": "quick_reply",
"index": "0",
"parameters": [
{ "type": "payload", "payload": "ORDER_STATUS" }
]
}See Meta's full component specification for all supported types.
Notes
- Templates must be approved in your Meta Business Manager before use.
- Use Watzy Dashboard → Templates to browse and sync approved templates.
- The
languagecode must match exactly what was approved —en_US≠en.