Send a template message
Approved templates are the only way to start a conversation with a customer outside the 24-hour window. Templates are managed in the dashboard (WhatsApp → Templates) and can be listed programmatically from the Templates endpoint.
Before starting a conversation, record the customer’s actual WhatsApp opt-in using the consent endpoint. A template’s approval does not establish recipient consent. Keep your API key on your server.
POST /api/v1/whatsapp/messages/send-template
curl -X POST "https://nabbih.com/api/v1/whatsapp/messages/send-template" \
-H "Authorization: Bearer {YOUR_API_KEY}" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: {unique-key}" \
-d "{
\"to\": \"+966500000000\",
\"template_id\": 42,
\"parameters\": [\"Ahmed\"],
\"account_id\": 1,
\"phone_number_id\": 3
}"
Fields
| Field | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Recipient number in international format (E.164) — 8 to 15 digits. |
| template_id | integer | Yes | The Nabbih template ID (from the Templates endpoint). |
| parameters | string[] | No | Template variables, in order (up to 20). |
| account_id | integer | No | WhatsApp account ID — inferred automatically if you have one. |
| phone_number_id | integer | No | Sending number ID — inferred automatically if the account has one. |
Response
202 accepted
{
"data": {
"message_id": 1024,
"attempt_id": 512,
"status": "pending",
"created": true
}
}
created: true means a new send was created (HTTP 202).
Sending the same Idempotency-Key again returns the same request with
created: false (HTTP 200) without a duplicate send.
Requires the whatsapp:send ability.