Templates
List templates
GET
/templatesScope templates:readReturns your approved templates. Each one lists the variables to fill in and its buttons, so you know exactly what Send a template message expects.
Query parameters
numberstringOnly the templates one of your WhatsApp numbers can send. Accepts the number, its Meta
phone_number_idor its Wamafy id.statusstringReview status to return. Defaults to
approved. Useallto follow a template you just submitted.One of:
approved,pending,rejected,paused,disabled,all
Good to know
variableFormatispositional(keys"1","2") ornamed(keys are placeholder names such ascustomer_name). Use these keys invariableswhen you send.- A button with
needsValue: truemust be given a value inbuttonswhen you send, at the sameindex. - A template with an
order_detailsbutton (Review and pay, a payment inside WhatsApp) cannot be sent through the API: only renewal reminders in Wamafy send it, and a send is refused with the reason. headerTypeisimage,video,document,textornull. For the first three, send the file asheaderMediaUrl.- Templates belong to a WhatsApp Business Account. Two numbers in the same account share them.
Errors
| Status | Code | When |
|---|---|---|
| 404 | NOT_FOUND | number does not match any of your WhatsApp numbers. |
Plus the errors any endpoint can return, such as a missing key or scope. See Errors.
Request
# macOS, Linux or Git Bash, with WAMAFY_API_KEY set. The quoting does not work in Windows cmd or PowerShell.
curl "https://api.wamafy.com/api/v1/public/templates" \
-H "Authorization: Bearer $WAMAFY_API_KEY"Response 200
{
"success": true,
"data": [
{
"name": "order_update",
"language": "en",
"category": "UTILITY",
"status": "APPROVED",
"bodyText": "Hi {{1}}, your order {{2}} is on its way.",
"headerType": null,
"variableFormat": "positional",
"variables": [
{
"key": "1",
"example": "Priya"
},
{
"key": "2",
"example": "#1043"
}
],
"buttons": [
{
"index": 0,
"type": "url",
"text": "Track order",
"needsValue": true,
"tracked": true
},
{
"index": 1,
"type": "quick_reply",
"text": "Talk to us",
"needsValue": false,
"tracked": false
}
]
}
]
}Base URL https://api.wamafy.com/api/v1/public