Templates

Create a template

POST/templatesScope templates:write

Creates a template and submits it to Meta for review. Most are approved within minutes. Check with List templates and status=all until it shows APPROVED.

The fields below are for a standard template. Carousel, catalog, product and limited-time offer templates are easier to build in the dashboard.

Query parameters

  • numberstring

    Create it in the WhatsApp Business Account of this number. Defaults to your default number's account.

Body

  • variantstringrequired

    Template kind. Use STANDARD.

    One of: STANDARD, CAROUSEL, CATALOG, PRODUCT_LIST, SINGLE_PRODUCT, PRODUCT_CAROUSEL, LIMITED_TIME_OFFER

  • namestringrequired

    Lowercase letters, numbers and underscores, for example order_shipped.

  • categorystringrequired

    How Meta classifies and prices it.

    One of: MARKETING, UTILITY, AUTHENTICATION

  • languagestring

    Language code. Defaults to en.

  • headerobjectrequired

    Use { "type": "NONE" } for no header, { "type": "TEXT", "text": "..." } for a text header, or IMAGE, VIDEO or DOCUMENT with a mediaHandle from Upload a file.

  • bodystringrequired

    Message text, with placeholders such as {{1}}.

  • bodyExamplesstring[]

    An example value for each positional placeholder, in order. Meta needs these to review the template.

  • bodyExamplesNamedobject[]

    For named placeholders: { "param_name": "...", "example": "..." } for each.

  • footerstring

    Small grey line under the body.

  • buttonsobject[]

    Up to 10 buttons. Each has a type (QUICK_REPLY, URL, PHONE_NUMBER, COPY_CODE) and text. A URL button takes url; put {{1}} at the end to make the link dynamic, and give an example. A PHONE_NUMBER button takes phoneNumber.

Good to know

  • A deleted template's name cannot be reused for about four weeks. Fix a rejected template by creating it under a new name.

Errors

StatusCodeWhen
400BAD_REQUESTMeta refused the template. The message carries Meta's reason in plain words.
422VALIDATION_ERRORA field is missing or the wrong shape.

Plus the errors any endpoint can return, such as a missing key or scope. See Errors.

# macOS, Linux or Git Bash, with WAMAFY_API_KEY set. The quoting does not work in Windows cmd or PowerShell.
curl -X POST "https://api.wamafy.com/api/v1/public/templates" \
  -H "Authorization: Bearer $WAMAFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "variant": "STANDARD",
  "name": "order_shipped",
  "category": "UTILITY",
  "language": "en",
  "header": {
    "type": "NONE"
  },
  "body": "Hi {{1}}, your order {{2}} has shipped.",
  "bodyExamples": [
    "Priya",
    "#1043"
  ]
}'
Response 201
{
  "success": true,
  "data": {
    "name": "order_shipped",
    "language": "en",
    "category": "UTILITY",
    "status": "PENDING"
  }
}

Base URL https://api.wamafy.com/api/v1/public

    Create a template - Wamafy API