Skip to main content
Glama

waha_send_contact

Send contact cards to WhatsApp chats using vCard format. Share contact information by specifying chat ID and vCard data, with optional message reply functionality.

Instructions

Send contact card(s) to a WhatsApp chat using vCard format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)
vcardYesvCard formatted contact data (e.g., 'BEGIN:VCARD\nVERSION:3.0\nFN:Jane Doe\nTEL:+1234567890\nEND:VCARD')
replyToNoOptional message ID to reply to

Implementation Reference

  • The main handler function that executes the waha_send_contact tool logic, validating inputs, calling WAHAClient.sendContact, formatting response with formatSendMessageSuccess
    private async handleSendContact(args: any) {
      const chatId = args.chatId;
      const vcard = args.vcard;
      const replyTo = args.replyTo;
    
      if (!chatId) {
        throw new Error("chatId is required");
      }
    
      if (!vcard) {
        throw new Error("vcard is required");
      }
    
      const response = await this.wahaClient.sendContact({
        chatId,
        contacts: [{ vcard }],
        reply_to: replyTo,
      });
    
      const formattedResponse = formatSendMessageSuccess(
        chatId,
        response.id,
        response.timestamp
      );
    
      return {
        content: [
          {
            type: "text",
            text: `${formattedResponse}\nContact card sent successfully.`,
          },
        ],
      };
    }
  • Input schema definition and description for the waha_send_contact tool, registered in ListToolsRequestSchema handler
      name: "waha_send_contact",
      description: "Send contact card(s) to a WhatsApp chat using vCard format.",
      inputSchema: {
        type: "object",
        properties: {
          chatId: {
            type: "string",
            description: "Chat ID (format: number@c.us)",
          },
          vcard: {
            type: "string",
            description: "vCard formatted contact data (e.g., 'BEGIN:VCARD\\nVERSION:3.0\\nFN:Jane Doe\\nTEL:+1234567890\\nEND:VCARD')",
          },
          replyTo: {
            type: "string",
            description: "Optional message ID to reply to",
          },
        },
        required: ["chatId", "vcard"],
      },
    },
  • src/index.ts:1085-1086 (registration)
    Tool dispatch/registration in the CallToolRequestSchema switch statement
    case "waha_send_contact":
      return await this.handleSendContact(args);
  • Underlying WAHAClient method that makes the HTTP POST request to /api/sendContactVcard to send the contact vCard
    async sendContact(params: {
      chatId: string;
      contacts: Array<{ vcard: string }>;
      reply_to?: string;
    }): Promise<SendMessageResponse> {
      const { chatId, contacts, reply_to } = params;
    
      if (!chatId) {
        throw new WAHAError("chatId is required");
      }
    
      if (!contacts || contacts.length === 0) {
        throw new WAHAError("contacts array is required");
      }
    
      const body = {
        chatId,
        contacts,
        session: this.session,
        reply_to,
      };
    
      return this.request<SendMessageResponse>("/api/sendContactVcard", {
        method: "POST",
        body: JSON.stringify(body),
      });
    }

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/seejux/waha-mcp'

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