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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create message template

> Create a WhatsApp utility or marketing template and submit it for Meta review.

`createWhatsAppMessageTemplate` creates a template on the connected WhatsApp Business Account. Meta must approve the template before you use it with `sendWhatsAppTemplateMessage`.

```ts automations/create-whatsapp-template.automation.ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { createWhatsAppMessageTemplate } from "automate.ax/whatsapp"

export default automation("Create pickup template", () => {
  onHttpRequest({ scope: "automation" })

  createWhatsAppMessageTemplate({
    templateName: "order_ready",
    languageCode: "en_US",
    category: "utility",
    header: {
      format: "text",
      text: "Order {{1}}",
      variableExamples: ["A-123"],
    },
    body: "Your order {{1}} is ready for pickup.",
    bodyVariableExamples: ["A-123"],
    footer: "Reply for support.",
    buttons: [
      {
        type: "url",
        text: "Track order",
        url: "https://example.com/orders/{{1}}",
        variableExample: "https://example.com/orders/A-123",
      },
    ],
  })
})
```

`templateName`, `languageCode`, `category`, and `body` are required. The name must contain only lowercase letters, numbers, and underscores. `category` is `"utility"` or `"marketing"`.

Body variable examples correspond to `{{1}}`, `{{2}}`, and later variables in order. Provide exactly one example per distinct body variable, or omit `bodyVariableExamples` when the body has no variables. A header can contain text, a Meta media example handle for an image, video, or document, or a location. Buttons support quick replies, phone numbers, and URLs. `allowCategoryChange` defaults to `true`, allowing Meta to recategorize the template instead of rejecting an otherwise valid submission. `account` selects the WhatsApp binding.

Returns `{ templateId, category, status }`. The initial status is commonly `pending`; Meta can also immediately approve or reject a template. Creating the template does not send a message.
