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

# Templates

> Create, submit, and manage WhatsApp message templates with multi-language support, component editors, and approval tracking through the Zeplo API.

# Templates

WhatsApp requires all business-initiated messages to use pre-approved templates. Zeplo simplifies the entire template lifecycle: create templates with text, images, buttons, and headers; submit them for Meta approval; track their status in real time; and manage translations across multiple languages. Templates are the foundation for campaigns and automated messages.

> **Template Creation**
>
> Build templates with headers, body text, footers, and interactive buttons. Use variable placeholders for dynamic personalization.

> **Approval Tracking**
>
> Monitor the approval status of every template in real time. Receive webhook notifications when a template is approved or rejected.

> **Multi-language**
>
> Create translations of each template for every market you serve. Switch languages dynamically based on contact preferences.

> **Template Components**
>
> Compose templates from reusable components — headers (text, image, video), body with variables, footer, and quick-reply or URL buttons.

## Basic Usage

**JavaScript/TypeScript**

```typescript theme={null}
import { Zeplo } from "@zeplo/sdk";

const zeplo = new Zeplo({ apiKey: process.env.ZEPLO_API_KEY });

// Create a template
const template = await zeplo.templates.create({
  name: "order_confirmation",
  category: "UTILITY",
  language: "en",
  components: [
    {
      type: "header",
      format: "text",
      text: "Order Confirmed!",
    },
    {
      type: "body",
      text: "Hi {{1}}, your order #{{2}} has been confirmed. Estimated delivery: {{3}}.",
    },
    {
      type: "footer",
      text: "Reply HELP for support",
    },
    {
      type: "button",
      buttons: [
        { type: "quick_reply", text: "Track Order" },
        { type: "url", text: "View Details", url: "https://example.com/orders/{{2}}" },
      ],
    },
  ],
});

// List templates
const { templates } = await zeplo.templates.list({
  status: "approved",
  category: "UTILITY",
});

// Add a translation
await zeplo.templates.addTranslation(template.id, {
  language: "es",
  components: [
    {
      type: "body",
      text: "Hola {{1}}, tu pedido #{{2}} ha sido confirmado. Entrega estimada: {{3}}.",
    },
  ],
});

// Delete a template
await zeplo.templates.delete(template.id);

console.log(`Template "${template.name}" status: ${template.status}`);
```

**Python**

```python theme={null}
import os
from zeplo import Zeplo

zeplo = Zeplo(api_key=os.environ["ZEPLO_API_KEY"])

# Create a template
template = zeplo.templates.create(
    name="order_confirmation",
    category="UTILITY",
    language="en",
    components=[
        {
            "type": "header",
            "format": "text",
            "text": "Order Confirmed!",
        },
        {
            "type": "body",
            "text": "Hi {{1}}, your order #{{2}} has been confirmed. Estimated delivery: {{3}}.",
        },
        {
            "type": "footer",
            "text": "Reply HELP for support",
        },
        {
            "type": "button",
            "buttons": [
                {"type": "quick_reply", "text": "Track Order"},
                {"type": "url", "text": "View Details", "url": "https://example.com/orders/{{2}}"},
            ],
        },
    ],
)

# List templates
result = zeplo.templates.list(status="approved", category="UTILITY")
templates = result.templates

# Add a translation
zeplo.templates.add_translation(
    template.id,
    language="es",
    components=[
        {
            "type": "body",
            "text": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado. Entrega estimada: {{3}}.",
        },
    ],
)

# Delete a template
zeplo.templates.delete(template.id)

print(f'Template "{template.name}" status: {template.status}')
```

> [!WARNING]
>
> Template names must be unique within your account and can only contain lowercase letters, numbers, and underscores. Once a template is approved, you cannot edit its structure — you must create a new template and delete the old one.

## Template Categories

| Category | Description | Use Cases |
| - | - | - |
| `MARKETING` | Promotional content and offers | Sale announcements, product launches, re-engagement campaigns |
| `UTILITY` | Transactional and account-related messages | Order confirmations, delivery updates, payment receipts, appointment reminders |
| `AUTHENTICATION` | One-time passwords and verification codes | Login verification, account recovery, two-factor authentication |

## Best Practices

> Use a consistent naming pattern that reflects the template's purpose and language. For example, `order_confirmation_en`, `welcome_series_01_en`, or `payment_receipt_en`. This makes templates searchable and avoids confusion when managing dozens of templates.

> Limit parameters to **5 or fewer** per template body. Too many variables make the template harder to read and increase the risk of missing data at send time. Always provide sensible default fallback values in your application logic.

> Meta reviews templates for clarity, accuracy, and compliance. Avoid ALL CAPS, excessive punctuation, misleading urgency ("ACT NOW!!!"), and promotional language in UTILITY templates. Include clear opt-out instructions in MARKETING templates to improve approval odds.

> Create multiple template variants for the same message and rotate them in campaigns to find the highest engagement. Track read rates and reply rates per variant and promote the winner. Use the `template_parameters` mapping in campaigns to keep variable structure consistent across variants.

> **[API Reference: List Templates](https://docs.zeplo.ai/docs/api-reference/templates/list-templates.md)**
>
> Explore the full request schema, component definitions, and response format for the templates endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.