---
title: "Example: send a template"
description: "Send an order update template with body variables."
---

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

# Example: send a template

Use this flow when you need to notify a customer **outside** the 24-hour reply window.

## 1. Confirm the template exists

List approved templates:

### cURL

```bash
curl -sS "https://api.wazapin.com/v1/templates?limit=20" \
  -H "X-Api-Key: YOUR_API_KEY"
```
### TypeScript

```typescript
import { WazapinClient } from "@wazapin/sdk";

const wazapin = new WazapinClient({ apiKey: process.env.WAZAPIN_API_KEY! });

const { data } = await wazapin.templates.list({ limit: 20 });
console.log(data);
```
### Python

```python
import requests

response = requests.get(
"https://api.wazapin.com/v1/templates",
headers={"X-Api-Key": "YOUR_API_KEY"},
params={"limit": 20},
timeout=30,
)
response.raise_for_status()
print(response.json())
```

Pick `name` and `language` from the response. The template must be **approved** on your channel.

## 2. Send with components

Template `order_shipped` with body `Hi {{1}}, order {{2}} shipped.`

### cURL

```bash
curl -X POST "https://api.wazapin.com/v1/messages" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
"channel_id": "wzp_abc123",
"to": "6281234567890",
"type": "template",
"content": {
  "template": {
    "name": "order_shipped",
    "language": { "code": "en_US" },
    "components": [
      {
        "type": "body",
        "parameters": [
          { "type": "text", "text": "John" },
          { "type": "text", "text": "ORD-42" }
        ]
      }
    ]
  }
}
  }'
```
### TypeScript

```typescript
import { WazapinClient, templateMessage } from "@wazapin/sdk";

const wazapin = new WazapinClient({ apiKey: process.env.WAZAPIN_API_KEY! });

await wazapin.messages.send(
  templateMessage({
channel_id: "wzp_abc123",
to: "6281234567890",
name: "order_shipped",
language: "en_US",
components: [
  {
    type: "body",
    parameters: [
      { type: "text", text: "John" },
      { type: "text", text: "ORD-42" },
    ],
  },
],
  }),
);
```
### Python

```python
import requests

response = requests.post(
"https://api.wazapin.com/v1/messages",
headers={"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
json={
    "channel_id": "wzp_abc123",
    "to": "6281234567890",
    "type": "template",
    "content": {
        "template": {
            "name": "order_shipped",
            "language": {"code": "en_US"},
            "components": [
                {
                    "type": "body",
                    "parameters": [
                        {"type": "text", "text": "John"},
                        {"type": "text", "text": "ORD-42"},
                    ],
                }
            ],
        }
    },
},
timeout=30,
)
response.raise_for_status()
print(response.json())
```

If your template has a **header image** or **URL button**, add the matching `header` / `button` components — see [Send template](/getting-started/send-template).

## 3. Check delivery

### cURL

```bash
curl -sS "https://api.wazapin.com/v1/messages/{messageID}" \
  -H "X-Api-Key: YOUR_API_KEY"
```
### TypeScript

```typescript
import { WazapinClient } from "@wazapin/sdk";

const wazapin = new WazapinClient({ apiKey: process.env.WAZAPIN_API_KEY! });

const { data: message } = await wazapin.messages.get("{messageID}");
console.log(message.status);
```
### Python

```python
import requests

response = requests.get(
"https://api.wazapin.com/v1/messages/{messageID}",
headers={"X-Api-Key": "YOUR_API_KEY"},
timeout=30,
)
response.raise_for_status()
print(response.json())
```

Or configure a [webhook](/api/webhooks) for `message.status_update` events.

## Unofficial channels

On unofficial (gateway) channels, template sends may render as fallback text. See [Channel support](/api/channel-support).

Source: https://docs.wazapin.id/recipes/send-template-message/index.mdx
