> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leavo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> WhatsApp Business message templates (Meta/Gupshup)

## What are Templates?

Templates are pre-approved message models by Meta for sending via WhatsApp Business API (Gupshup). They are required to initiate conversations or re-engage leads after the 24-hour window.

<CardGroup cols={2}>
  <Card title="Marketing" icon="bullhorn">
    Promotions, news, and campaigns
  </Card>

  <Card title="Utility" icon="wrench">
    Transactional notifications, confirmations, reminders
  </Card>
</CardGroup>

## How It Works

<Steps>
  <Step title="Create template in Gupshup">
    Configure the template in the Gupshup dashboard with desired components (header, body, footer, buttons).
  </Step>

  <Step title="Wait for Meta approval">
    Templates must be approved by Meta before use. Possible statuses: `APPROVED`, `PENDING`, `REJECTED`.
  </Step>

  <Step title="Sync with Leavo">
    The meta-service automatically syncs approved templates with Leavo.
  </Step>

  <Step title="Use in cadences and follow-ups">
    Associate templates with cadence steps or configure follow-ups with official templates.
  </Step>
</Steps>

## Template Model

```json theme={null}
{
  "id": "uuid",
  "tenant_id": "uuid",
  "gupshup_app_id": "app_12345",
  "template_name": "welcome_v1",
  "template_id": "gupshup_template_id",
  "language": "en",
  "status": "APPROVED",
  "category": "MARKETING",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Welcome, {{1}}!"
    },
    {
      "type": "BODY",
      "text": "Hello {{1}}, thanks for signing up at {{2}}. We're ready to help!"
    },
    {
      "type": "FOOTER",
      "text": "Leavo - Smart automation"
    }
  ],
  "last_synced_at": "2024-01-15T10:00:00Z",
  "created_at": "2024-01-15T10:00:00Z"
}
```

## Template Status

| Status     | Description                         |
| ---------- | ----------------------------------- |
| `APPROVED` | Approved by Meta, ready to use      |
| `PENDING`  | Awaiting Meta review                |
| `REJECTED` | Rejected by Meta (needs adjustment) |

<Warning>
  Only templates with `APPROVED` status can be used in cadences and follow-ups.
</Warning>

## Categories

| Category         | Use                               |
| ---------------- | --------------------------------- |
| `MARKETING`      | Promotions, offers, engagement    |
| `UTILITY`        | Confirmations, reminders, updates |
| `AUTHENTICATION` | Verification codes, login         |

## Endpoints

| Method   | Endpoint                  | Description                 |
| -------- | ------------------------- | --------------------------- |
| `GET`    | `/backend/templates`      | List templates              |
| `GET`    | `/backend/templates/{id}` | Get template                |
| `DELETE` | `/backend/templates/{id}` | Delete template             |
| `POST`   | `/backend/templates/sync` | Sync templates from Gupshup |
