Templates
Create a template
/templatesScope templates:writeCreates 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
numberstringCreate it in the WhatsApp Business Account of this number. Defaults to your default number's account.
Body
variantstringrequiredTemplate kind. Use
STANDARD.One of:
STANDARD,CAROUSEL,CATALOG,PRODUCT_LIST,SINGLE_PRODUCT,PRODUCT_CAROUSEL,LIMITED_TIME_OFFERnamestringrequiredLowercase letters, numbers and underscores, for example
order_shipped.categorystringrequiredHow Meta classifies and prices it.
One of:
MARKETING,UTILITY,AUTHENTICATIONlanguagestringLanguage code. Defaults to
en.headerobjectrequiredUse
{ "type": "NONE" }for no header,{ "type": "TEXT", "text": "..." }for a text header, orIMAGE,VIDEOorDOCUMENTwith amediaHandlefrom Upload a file.bodystringrequiredMessage 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.footerstringSmall grey line under the body.
buttonsobject[]Up to 10 buttons. Each has a
type(QUICK_REPLY,URL,PHONE_NUMBER,COPY_CODE) andtext. AURLbutton takesurl; put{{1}}at the end to make the link dynamic, and give anexample. APHONE_NUMBERbutton takesphoneNumber.
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
| Status | Code | When |
|---|---|---|
| 400 | BAD_REQUEST | Meta refused the template. The message carries Meta's reason in plain words. |
| 422 | VALIDATION_ERROR | A 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"
]
}'{
"success": true,
"data": {
"name": "order_shipped",
"language": "en",
"category": "UTILITY",
"status": "PENDING"
}
}Base URL https://api.wamafy.com/api/v1/public