---
title: "Templates"
description: "List, inspect, sync, and send WhatsApp templates with @wazapin/sdk."
---

> 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.

# Templates

:::note
For general message template concepts, approval rules, and categories, see the [Templates overview](/templates/overview).
:::

## Send a template

`templateMessage()` builds the nested wire shape the API expects — `content.template.name`, `content.template.language.code`, and `content.template.components`.

```ts
import { templateMessage } from "@wazapin/sdk";

await wazapin.messages.send(
  templateMessage({
channel_id: "wzp_ch_123",
to: "6281234567890",
name: "order_confirmation",
language: "en_US",
components: [
  {
    type: "body",
    parameters: [{ type: "text", text: "Order #123" }],
  },
],
  }),
);
```

Equivalent JSON body:

```json
{
  "channel_id": "wzp_ch_123",
  "to": "6281234567890",
  "type": "template",
  "content": {
"template": {
  "name": "order_confirmation",
  "language": { "code": "en_US" },
  "components": [
    {
      "type": "body",
      "parameters": [{ "type": "text", "text": "Order #123" }]
    }
  ]
}
  }
}
```

## List templates

```ts
const { data: page } = await wazapin.templates.list({ limit: 50 });

for (const template of page.items) {
  console.log(template.id);
}
```

## Get one template

```ts
const template = await wazapin.templates.get("tpl_123");
```

## Sync templates

```ts
await wazapin.templates.sync();
```

Source: https://docs.wazapin.id/sdk/templates/index.mdx
