Skip to main content
Glama

waha_create_group

Create a new WhatsApp group by specifying a group name and participant list in JSON format.

Instructions

Create a new WhatsApp group.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesGroup name
participantsYesJSON array of participants (format: [{'id': 'number@c.us'}, ...])

Implementation Reference

  • MCP tool handler for 'waha_create_group'. Validates input arguments, parses participants JSON, calls WAHAClient.createGroup, and returns formatted success response with group details.
    private async handleCreateGroup(args: any) {
      const name = args.name;
      const participantsStr = args.participants;
    
      if (!name) {
        throw new Error("name is required");
      }
    
      if (!participantsStr) {
        throw new Error("participants is required");
      }
    
      const participants = JSON.parse(participantsStr);
    
      const result = await this.wahaClient.createGroup({
        name,
        participants,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully created group "${name}".\nGroup details:\n${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • Input schema definition for the 'waha_create_group' tool, specifying required 'name' and 'participants' (as JSON string).
      name: "waha_create_group",
      description: "Create a new WhatsApp group.",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Group name",
          },
          participants: {
            type: "string",
            description: "JSON array of participants (format: [{'id': 'number@c.us'}, ...])",
          },
        },
        required: ["name", "participants"],
      },
    },
  • src/index.ts:1101-1102 (registration)
    Tool execution registration in the CallToolRequestSchema switch statement, dispatching to handleCreateGroup.
    case "waha_create_group":
      return await this.handleCreateGroup(args);
  • WAHAClient helper method that performs the actual HTTP POST request to WAHA API endpoint /api/{session}/groups to create the group.
    async createGroup(params: {
      name: string;
      participants: Array<{ id: string }>;
    }): Promise<any> {
      const { name, participants } = params;
    
      if (!name) {
        throw new WAHAError("name is required");
      }
    
      if (!participants || participants.length === 0) {
        throw new WAHAError("participants array is required");
      }
    
      const body = { name, participants };
    
      return this.request<any>(`/api/${this.session}/groups`, {
        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