Concepts: Templates overview | Authentication & OTP templates
Before you send
Create and approve the template
Create the template in the Wazapin app or sync from Meta on official channels. Status must be approved.
GET /v1/templates lists templates for your workspace. See Channel support for official vs unofficial behavior.Read the template structure
Open the template in the app and note:
- Header — none, text (
{{1}}), image, video, or document - Body — static text with
{{1}},{{2}}, … placeholders - Buttons — quick reply, URL (may include
{{1}}in the link), copy code, etc.
components array must mirror these sections in order.Build the components array
Each section becomes one object in
Omit a section if the template has no variables in that part.
content.template.components:Component type | When required |
|---|---|
header | Template has a dynamic header (text, image, video, document) |
body | Template body has {{n}} variables |
button | URL or other dynamic button parameters (sub_type, index) |
Request shape
All template sends usePOST /v1/messages with type: "template" and a nested content.template object (Meta-compatible shape).
| Field | Required | Description |
|---|---|---|
channel_id | Yes | Connected WhatsApp channel |
to | Yes | Recipient phone (international format) |
type | Yes | template |
content.template.name | Yes | Approved template name |
content.template.language.code | Yes | Locale, e.g. en_US, id |
content.template.components | Often | Parameters per header/body/button |
Example: body variables only
Template body:Hi {{1}}, your order {{2}} is on the way.
Example: header image + body
Template with an image header and one body variable.Example: header text variable
Template header text:Hello {{1}} — the header component lives inside content.template.components.
Example: dynamic URL button
Template with a URL button containing{{1}} in the path — button component nested in the same components array.
index is the zero-based button index in the template definition. sub_type matches the button type Meta approved (url, quick_reply, copy_code, etc.).
List and sync templates with wazapin.templates.list() and wazapin.templates.sync(). See SDK templates (advanced).
Common mistakes
| Mistake | Fix |
|---|---|
| Template not approved | Wait for Meta approval or pick another name |
Wrong language.code | Must match the template locale exactly (en_US vs en) |
Missing components | Add parameters for every {{n}} in header/body/buttons |
Flat template_name in content | Use nested content.template.name |
| Header image URL not HTTPS | Use a public HTTPS URL Meta can fetch |
Related
- Sending overview — session vs template
- Example: send template
- Send a message — API reference and playground
- Channel support — unofficial channel fallback behavior
Endpoint
POST https://api.wazapin.com/v1/messages
Authenticate with X-Api-Key. See Authentication.
Response
On success, the API returns201 Created with a message record (status often starts as queued).
201 Created