Documentation ›
Messages › Send WhatsApp template (Meta)
POST
Send WhatsApp template (Meta)
POSThttps://app.sendapp.ai/api/whatsapp-meta/send
Send an approved template through Meta's WhatsApp Cloud API (
type=template). Templates are used to start a conversation or to message the customer outside the 24-hour window. The template must already be approved by Meta. See Create template to create one. The text variables (
{{1}}, {{2}}…) are filled through the components array.Parameters
apikey
required
Your API Key.
token
required
Account token.
number
required
Recipient number in international format without + (e.g. 1234567890).
type
required
Must be
template.
template.name
required
Exact name of the approved template.
template.language.code
required
Template language code (e.g.
it, en_US).
template.components
optional
Values for the template variables (body, header, buttons). Omit if the template has no variables.
Request
# Template without variables
curl -X POST 'https://app.sendapp.ai/api/whatsapp-meta/send' \
-H 'Content-Type: application/json' \
-d '{
"apikey": "YOUR_API_KEY",
"token": "YOUR_ACCOUNT_TOKEN",
"number": "1234567890",
"type": "template",
"template": {
"name": "hello_world",
"language": { "code": "en_US" }
}
}'
# Template with variables {{1}} and {{2}}
curl -X POST 'https://app.sendapp.ai/api/whatsapp-meta/send' \
-H 'Content-Type: application/json' \
-d '{
"apikey": "YOUR_API_KEY",
"token": "YOUR_ACCOUNT_TOKEN",
"number": "1234567890",
"type": "template",
"template": {
"name": "promo_sconto",
"language": { "code": "it" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Mario" },
{ "type": "text", "text": "20" }
]
}
]
}
}'<?php
$ch = curl_init('https://app.sendapp.ai/api/whatsapp-meta/send');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'apikey' => 'YOUR_API_KEY',
'token' => 'YOUR_ACCOUNT_TOKEN',
'number' => '1234567890',
'type' => 'template',
'template' => [
'name' => 'promo_sconto',
'language' => ['code' => 'it'],
'components' => [[
'type' => 'body',
'parameters' => [
['type' => 'text', 'text' => 'Mario'],
['type' => 'text', 'text' => '20'],
],
]],
],
]),
]);
echo curl_exec($ch);const res = await fetch('https://app.sendapp.ai/api/whatsapp-meta/send', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
apikey: 'YOUR_API_KEY',
token: 'YOUR_ACCOUNT_TOKEN',
number: '1234567890',
type: 'template',
template: {
name: 'promo_sconto',
language: { code: 'it' },
components: [{
type: 'body',
parameters: [
{ type: 'text', text: 'Mario' },
{ type: 'text', text: '20' }
]
}]
}
})
});
console.log(await res.json());Response (200 OK)
{
"status": "success",
"message": "Message sent successfully",
"message_id": "wamid.HBgLMzkxMjM0NTY3ODkwFQIAERgSN0EwMjBBQkZDRDEyMzQ1Njc4"
}Error
{
"status": "error",
"message": "The template parameters do not match the approved template."
}