list_templates
Retrieve message templates from a WhatsApp Business Account to manage customer communication. Filter by approval status to organize templates for sending messages or reviewing submissions.
Instructions
List all message templates in the WhatsApp Business Account, optionally filtered by status.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_templates"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Filter templates by approval status | |
| limit | No | Max templates to return |
Implementation Reference
- src/whatsapp-client.ts:210-218 (handler)The implementation of listTemplates which makes the API request to fetch WhatsApp templates.
async listTemplates(params?: { status?: string; limit?: number }) { const qs = new URLSearchParams(); if (params?.status) qs.set("status", params.status); if (params?.limit) qs.set("limit", params.limit.toString()); const query = qs.toString() ? `?${qs.toString()}` : ""; return this.request( `/${this.config.businessAccountId}/message_templates${query}` ); } - src/index.ts:284-298 (registration)The MCP tool registration for 'list_templates', which calls the whatsapp-client handler.
server.tool( "list_templates", "List all message templates in the WhatsApp Business Account, optionally filtered by status.", { status: z .enum(["APPROVED", "PENDING", "REJECTED"]) .optional() .describe("Filter templates by approval status"), limit: z.number().optional().default(20).describe("Max templates to return"), }, async ({ status, limit }) => executeWithHooks("list_templates", { status, limit }, config, () => wa.listTemplates({ status, limit }) ) );