# Templates

Create, get approved and use a template.

A template is a model message that Meta approves in advance. It is the only way to write to a customer who has not written to you in the last 24 hours, and the only format accepted for a [campaign](/en/docs/campaigns).

## Categories

| Category | For | Note |
|---|---|---|
| `UTILITY` | Order tracking, appointments, invoices | The easiest to get approved. |
| `AUTHENTICATION` | One-time codes | Format imposed by Meta. |
| `MARKETING` | Promotions, news | Only contacts who consented receive the send. |

## Create a template

`POST /templates` submits the template to Meta. It goes through `draft`, `pending`, then `approved` or `rejected`.

```json
{
  "connectionId": "con_...",
  "name": "order_shipped",
  "language": "en",
  "category": "UTILITY",
  "components": [
    {
      "type": "BODY",
      "text": "Hello {{1}}, your order {{2}} has shipped.",
      "example": { "body_text": [["Awa", "A-2041"]] }
    }
  ]
}
```

`name` only accepts lowercase letters, digits and underscores. Components are passed to Meta as they are, including the `example` it requires for each variable. Variables are written `{{1}}`, `{{2}}`… and each one must receive a value at send time, otherwise Meta returns error [132000](/en/docs/errors/132000).

## Follow approval

`GET /templates` lists templates and their state. `POST /templates/sync` re-reads the state at Meta if you want to force it. Approval usually takes from a few minutes to a few hours.

If a template is rejected, Meta gives the reason: fix the text and submit a new version. A template whose quality drops can be paused ([132015](/en/docs/errors/132015)) then disabled ([132016](/en/docs/errors/132016)).

## Writing a good template

- One idea per message, said simply.
- Variables for what changes (first name, order number), not for the whole text.
- No promise you do not keep: customer reports lower the number's quality.
- For marketing, say who you are and offer to opt out (reply STOP).
