# Templates

> Create, edit, sync and delete WhatsApp message templates with Meta's own bodies; track review through events.

Canonical: https://docs.whabuzz.com/guides/templates/

Templates are how a business starts a conversation outside the 24-hour window. WhaBuzz passes Meta's template bodies through unchanged. Templates belong to a WABA, so list and create calls take a `waba_id`.

| Task | Endpoint |
|---|---|
| List (Meta's paging) | [`GET /v1/templates`](https://docs.whabuzz.com/api/templates.md#listTemplates) |
| Read one | [`GET /v1/templates/{template_id}`](https://docs.whabuzz.com/api/templates.md#getTemplate) |
| Create | [`POST /v1/templates`](https://docs.whabuzz.com/api/templates.md#createTemplate) |
| Edit | [`POST /v1/templates/{template_id}`](https://docs.whabuzz.com/api/templates.md#editTemplate) |
| Delete | [`DELETE /v1/templates/{template_id}`](https://docs.whabuzz.com/api/templates.md#deleteTemplate) |
| Import everything already on the WABA | [`POST /v1/templates/sync`](https://docs.whabuzz.com/api/templates.md#syncTemplates) |
| Meta's template library | [`GET /v1/templates/library`](https://docs.whabuzz.com/api/templates.md#listTemplateLibrary) |
| Upload header media (get a handle) | [`POST /v1/templates/media-handle`](https://docs.whabuzz.com/api/templates.md#createTemplateMediaHandle) |

## Create {#create}

```bash
curl -X POST https://api.whabuzz.com/v1/templates \
  -H "Authorization: Bearer $WHABUZZ_KEY" -H "Content-Type: application/json" \
  -d '{
    "waba_id": "26059971920328384",
    "name": "renewal_reminder",
    "language": "en",
    "category": "UTILITY",
    "components": [
      { "type": "BODY", "text": "Hi {{1}}, your plan renews on {{2}}.",
        "example": { "body_text": [["Kerry", "31 Oct"]] } }
    ]
  }'
```

Meta answers with the template id, status (usually `PENDING`) and category.

## Review and status {#review}

Meta reviews templates asynchronously. You hear about the result as a [`template.status`](https://docs.whabuzz.com/events/template-status.md) event: `APPROVED`, `REJECTED` (with Meta's reason), `PAUSED`, `DISABLED`. Also watch [`template.quality`](https://docs.whabuzz.com/events/template-quality.md) and [`template.category`](https://docs.whabuzz.com/events/template-category.md): Meta can re-categorise a template, which changes what each send costs you at Meta.

Rejection reasons are also kept in `status_reason` when you list or sync.

## Sync {#sync}

[`POST /v1/templates/sync`](https://docs.whabuzz.com/api/templates.md#syncTemplates) walks the WABA's templates page by page and stores a local copy, so you can list them without hitting Meta each time. Call it once after connecting an existing WABA, and again if you create templates in Meta's own manager.

## Sending {#sending}

See [Sending messages](https://docs.whabuzz.com/guides/messages.md) and the template example in [Getting started](https://docs.whabuzz.com/getting-started.md#send-a-template). A template send that Meta rejects (wrong parameter count, unapproved template, paused template) answers with Meta's error and `"source":"meta"`.
