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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Group name | |
| participants | Yes | JSON array of participants (format: [{'id': 'number@c.us'}, ...]) |
Implementation Reference
- src/index.ts:1999-2026 (handler)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)}`, }, ], }; }
- src/index.ts:617-633 (schema)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);
- src/client/waha-client.ts:867-887 (helper)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), }); }