Skip to main content
Glama
EvandroSchechtel

WhatsApp Business MCP Server

send_template_message

Send pre-approved WhatsApp Business template messages to initiate conversations outside the 24-hour window using Meta-approved templates with customizable variables.

Instructions

Send a pre-approved template message. Required for initiating conversations outside the 24-hour window. Templates must be approved by Meta before use.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient phone number in international format
template_nameYesName of the approved template
languageNoTemplate language code (e.g., pt_BR, en_US)pt_BR
componentsNoTemplate components with variable values (header, body, button params)

Implementation Reference

  • Actual implementation of the WhatsApp template message sending logic.
    async sendTemplateMessage(
      to: string,
      templateName: string,
      language: string,
      components?: unknown[]
    ) {
      return this.request(`/${this.config.phoneNumberId}/messages`, "POST", {
        messaging_product: "whatsapp",
        to,
        type: "template",
        template: {
          name: templateName,
          language: { code: language },
          ...(components ? { components } : {}),
        },
      });
    }
  • src/index.ts:140-159 (registration)
    MCP tool registration for "send_template_message" which calls the handler in WhatsAppClient.
    server.tool(
      "send_template_message",
      "Send a pre-approved template message. Required for initiating conversations outside the 24-hour window. Templates must be approved by Meta before use.",
      {
        to: z.string().describe("Recipient phone number in international format"),
        template_name: z.string().describe("Name of the approved template"),
        language: z.string().default("pt_BR").describe("Template language code (e.g., pt_BR, en_US)"),
        components: z
          .array(z.record(z.string(), z.unknown()))
          .optional()
          .describe("Template components with variable values (header, body, button params)"),
      },
      async ({ to, template_name, language, components }) =>
        executeWithHooks(
          "send_template_message",
          { to, template_name, language, components },
          config,
          () => wa.sendTemplateMessage(to, template_name, language, components)
        )
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EvandroSchechtel/mcp-whatsapp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server