WhatsApp requires businesses to initiate customer communication (outside a rolling 24-hour service window) using pre-approved Meta Message Templates. Templates can include dynamic variables to merge personalized user parameters dynamically.
POST /v1/messages
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Destination mobile number (country code prefix). |
type | string | Yes | Must be set to template. |
template | object | Yes | Template configuration block. |
template.name | string | Yes | The exact name of your pre-approved template in Meta's Business Manager (e.g. order_confirmation). |
template.language | object | Yes | Language setting. |
template.language.code | string | Yes | The language code (e.g. en, es, hi) corresponding to the pre-approved template. |
template.components | array | No | List of dynamic template component parameters. |
template.components[i].type | string | Yes | Must match component section: header, body, or button. |
template.components[i].parameters | array | Yes | The dynamic merge variables matching the template placeholders (represented sequentially in template code as {{1}}, {{2}}). |
# Send dynamic business template
curl -X POST "https://api.aisoule.com/v1/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "918856879188",
"type": "template",
"template": {
"name": "order_confirmation",
"language": {
"code": "en"
},
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Priya Sharma" },
{ "type": "text", "text": "#2891" }
]
}
]
}
}'