create_template
Create message templates for WhatsApp Business to send outbound messages beyond the 24-hour window, requiring Meta approval for marketing, utility, or authentication purposes.
Instructions
Create a new message template for approval by Meta. Templates are required for outbound messages outside the 24-hour window.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Template name (lowercase, underscores only) | |
| language | No | Template language code | pt_BR |
| category | Yes | Template category — affects pricing and approval rules | |
| components | Yes | Template components: HEADER, BODY, FOOTER, BUTTONS |
Implementation Reference
- src/index.ts:300-317 (registration)Tool registration for "create_template" which takes input parameters and calls the wa client.
server.tool( "create_template", "Create a new message template for approval by Meta. Templates are required for outbound messages outside the 24-hour window.", { name: z.string().describe("Template name (lowercase, underscores only)"), language: z.string().default("pt_BR").describe("Template language code"), category: z .enum(["MARKETING", "UTILITY", "AUTHENTICATION"]) .describe("Template category — affects pricing and approval rules"), components: z .array(z.record(z.string(), z.unknown())) .describe("Template components: HEADER, BODY, FOOTER, BUTTONS"), }, async ({ name, language, category, components }) => executeWithHooks("create_template", { name, language, category }, config, () => wa.createTemplate({ name, language, category, components }) ) ); - src/whatsapp-client.ts:220-231 (handler)Implementation of createTemplate in the WhatsAppClient class, which makes the API call.
async createTemplate(template: { name: string; language: string; category: "MARKETING" | "UTILITY" | "AUTHENTICATION"; components: unknown[]; }) { return this.request( `/${this.config.businessAccountId}/message_templates`, "POST", template ); }