Templates
Base: /v2/templates
Auth + Premium/Enterprise + active plan required. POST routes also require phoneNumberId ownership — see overview — Phone number ownership and Account.
Also read: HTTP API v2 Overview
GET /v2/templates
Query (optional)
| Name | Description |
|---|---|
limit | Passed to Meta message templates API when set |
after | Cursor for paging |
search | Case-insensitive substring filter on template name (applied after fetch) |
Example request:
bash
curl -sS "https://api.avenping.com/v2/templates?limit=10&search=order" \
-H "Authorization: Bearer YOUR_TOKEN"Response 200 — items are Meta template objects; paging mirrors Meta when present.
json
{
"success": true,
"data": {
"items": [
{
"name": "order_confirmation",
"components": [],
"language": "en_US",
"status": "APPROVED",
"category": "UTILITY",
"id": "123456789012345"
}
],
"paging": {
"cursors": {
"before": "QVFIUz...",
"after": "QVFIUz..."
},
"next": "https://graph.facebook.com/..."
}
}
}GET /v2/templates/:name
Example request:
bash
curl -sS "https://api.avenping.com/v2/templates/order_confirmation" \
-H "Authorization: Bearer YOUR_TOKEN"Response 200 — single Meta template object in data (shape similar to one element of items above).
Response 404:
json
{
"success": false,
"error": "NOT_FOUND",
"message": "Template not found"
}POST /v2/templates/send
Body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
phoneNumberId | string | yes | Meta phone number ID (must belong to account) |
to | string | yes | E.164-like; non-digits stripped |
templateName | string | yes | Template name |
language | string | no | Default en_US |
components | array | no | Meta template components |
contextMessageWamid | string | no | Reply context wamid |
Example request:
bash
curl -sS -X POST "https://api.avenping.com/v2/templates/send" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phoneNumberId": "109876543210987",
"to": "+1 555 123 4567",
"templateName": "hello_world",
"language": "en_US",
"components": []
}'Response 200 — data is Meta’s successful messages API response (illustrative):
json
{
"success": true,
"data": {
"messaging_product": "whatsapp",
"contacts": [
{
"input": "15551234567",
"wa_id": "15551234567"
}
],
"messages": [
{
"id": "wamid.HBgL..."
}
]
}
}POST /v2/templates/:name/test-send
Same body as /send except templateName is taken from the path :name.
Example request:
bash
curl -sS -X POST "https://api.avenping.com/v2/templates/hello_world/test-send" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phoneNumberId": "109876543210987",
"to": "15551234567",
"language": "en_US"
}'Response 200 — same envelope as template send; data is Meta’s send response.