Skip to main content
Glama

waha_block_contact

Block unwanted WhatsApp contacts to prevent further communication. Specify the contact ID to restrict messages and calls from that user.

Instructions

Block a contact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactIdYesContact ID to block (format: number@c.us)

Implementation Reference

  • MCP tool handler for 'waha_block_contact'. Validates input, calls WAHAClient.blockContact, returns success response.
    private async handleBlockContact(args: any) {
      const contactId = args.contactId;
    
      if (!contactId) {
        throw new Error("contactId is required");
      }
    
      await this.wahaClient.blockContact(contactId);
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully blocked contact ${contactId}.`,
          },
        ],
      };
    }
  • src/index.ts:958-971 (registration)
    Tool registration entry in listTools response, including name, description, and input schema.
    {
      name: "waha_block_contact",
      description: "Block a contact.",
      inputSchema: {
        type: "object",
        properties: {
          contactId: {
            type: "string",
            description: "Contact ID to block (format: number@c.us)",
          },
        },
        required: ["contactId"],
      },
    },
  • Input schema definition for the waha_block_contact tool.
    inputSchema: {
      type: "object",
      properties: {
        contactId: {
          type: "string",
          description: "Contact ID to block (format: number@c.us)",
        },
      },
      required: ["contactId"],
    },
  • WAHAClient helper method that sends POST request to WAHA API endpoint /api/contacts/block to block the contact.
    async blockContact(contactId: string): Promise<void> {
      if (!contactId) {
        throw new WAHAError("contactId is required");
      }
    
      const body = {
        contactId,
        session: this.session,
      };
    
      await this.request<void>("/api/contacts/block", {
        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