Skip to main content
Glama
EvandroSchechtel

WhatsApp Business MCP Server

send_contact_message

Send contact cards to WhatsApp numbers using the WhatsApp Business API. Share contact information including names, phone numbers, and emails through automated messaging.

Instructions

Send a contact card to a WhatsApp number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient phone number
contactsYesArray of contact cards to send

Implementation Reference

  • The implementation of the logic to send a contact message via the WhatsApp API.
    async sendContactMessage(to: string, contacts: unknown[]) {
      return this.request(`/${this.config.phoneNumberId}/messages`, "POST", {
        messaging_product: "whatsapp",
        to,
        type: "contacts",
        contacts,
      });
    }
  • The input schema for the send_contact_message tool.
    {
      to: z.string().describe("Recipient phone number"),
      contacts: z
        .array(
          z.object({
            name: z.object({ formatted_name: z.string(), first_name: z.string().optional() }),
            phones: z.array(z.object({ phone: z.string(), type: z.string().optional() })).optional(),
            emails: z.array(z.object({ email: z.string(), type: z.string().optional() })).optional(),
          })
        )
        .describe("Array of contact cards to send"),
    },
  • src/index.ts:249-268 (registration)
    The registration of the send_contact_message MCP tool.
    server.tool(
      "send_contact_message",
      "Send a contact card to a WhatsApp number.",
      {
        to: z.string().describe("Recipient phone number"),
        contacts: z
          .array(
            z.object({
              name: z.object({ formatted_name: z.string(), first_name: z.string().optional() }),
              phones: z.array(z.object({ phone: z.string(), type: z.string().optional() })).optional(),
              emails: z.array(z.object({ email: z.string(), type: z.string().optional() })).optional(),
            })
          )
          .describe("Array of contact cards to send"),
      },
      async ({ to, contacts }) =>
        executeWithHooks("send_contact_message", { to, contacts }, config, () =>
          wa.sendContactMessage(to, contacts)
        )
    );

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