Skip to main content
Glama

waha_add_group_participants

Add participants to WhatsApp groups using admin privileges. Specify group ID and participant list in JSON format to manage group membership.

Instructions

Add member(s) to a group. Requires admin privileges.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupIdYesGroup ID (format: number@g.us)
participantsYesJSON array of participants to add (format: [{'id': 'number@c.us'}, ...])

Implementation Reference

  • The main MCP tool handler function that processes the tool call, validates input, parses the participants JSON string from input, calls the underlying WAHAClient method, and returns a formatted response with the result.
    private async handleAddGroupParticipants(args: any) {
      const groupId = args.groupId;
      const participantsStr = args.participants;
    
      if (!groupId) {
        throw new Error("groupId is required");
      }
    
      if (!participantsStr) {
        throw new Error("participants is required");
      }
    
      const participants = JSON.parse(participantsStr);
    
      const result = await this.wahaClient.addGroupParticipants({
        groupId,
        participants,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully added ${participants.length} participant(s) to group ${groupId}.\n${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • src/index.ts:698-715 (registration)
    Tool registration in the list of available tools returned by ListToolsRequestSchema. Includes name, description, and input schema definition.
    {
      name: "waha_add_group_participants",
      description: "Add member(s) to a group. Requires admin privileges.",
      inputSchema: {
        type: "object",
        properties: {
          groupId: {
            type: "string",
            description: "Group ID (format: number@g.us)",
          },
          participants: {
            type: "string",
            description: "JSON array of participants to add (format: [{'id': 'number@c.us'}, ...])",
          },
        },
        required: ["groupId", "participants"],
      },
    },
  • Input schema definition for the tool, specifying required groupId and participants as JSON string.
    inputSchema: {
      type: "object",
      properties: {
        groupId: {
          type: "string",
          description: "Group ID (format: number@g.us)",
        },
        participants: {
          type: "string",
          description: "JSON array of participants to add (format: [{'id': 'number@c.us'}, ...])",
        },
      },
      required: ["groupId", "participants"],
    },
  • Underlying WAHA API client method that makes the HTTP POST request to the WAHA server endpoint /api/{session}/groups/{groupId}/participants/add to add participants to the group.
    async addGroupParticipants(params: {
      groupId: string;
      participants: Array<{ id: string }>;
    }): Promise<any> {
      const { groupId, participants } = params;
    
      if (!groupId) {
        throw new WAHAError("groupId is required");
      }
    
      if (!participants || participants.length === 0) {
        throw new WAHAError("participants array is required");
      }
    
      const endpoint = `/api/${this.session}/groups/${encodeURIComponent(groupId)}/participants/add`;
    
      const body = { participants };
    
      return this.request<any>(endpoint, {
        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