Skip to content

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)

NameDescription
limitPassed to Meta message templates API when set
afterCursor for paging
searchCase-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 200items 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)

FieldTypeRequiredNotes
phoneNumberIdstringyesMeta phone number ID (must belong to account)
tostringyesE.164-like; non-digits stripped
templateNamestringyesTemplate name
languagestringnoDefault en_US
componentsarraynoMeta template components
contextMessageWamidstringnoReply 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 200data 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.