Skip to main content
Glama
EvandroSchechtel

WhatsApp Business MCP Server

send_text_message

Send text messages to WhatsApp numbers within the 24-hour conversation window for customer communication and automated interactions.

Instructions

Send a text message to a WhatsApp number. Works within the 24-hour conversation window. For messages outside this window, use send_template_message instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient phone number in international format (e.g., 5541999999999)
bodyYesMessage text content
preview_urlNoWhether to show URL previews

Implementation Reference

  • The core handler function in WhatsAppClient that executes the API request to send a text message.
    async sendTextMessage(to: string, body: string, previewUrl = false) {
      return this.request(`/${this.config.phoneNumberId}/messages`, "POST", {
        messaging_product: "whatsapp",
        to,
        type: "text",
        text: { preview_url: previewUrl, body },
      });
  • src/index.ts:126-138 (registration)
    Registration of the send_text_message tool, including schema validation and the hook wrapper around the handler.
    server.tool(
      "send_text_message",
      "Send a text message to a WhatsApp number. Works within the 24-hour conversation window. For messages outside this window, use send_template_message instead.",
      {
        to: z.string().describe("Recipient phone number in international format (e.g., 5541999999999)"),
        body: z.string().describe("Message text content"),
        preview_url: z.boolean().optional().default(false).describe("Whether to show URL previews"),
      },
      async ({ to, body, preview_url }) =>
        executeWithHooks("send_text_message", { to, body, preview_url }, config, () =>
          wa.sendTextMessage(to, body, preview_url)
        )
    );

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