waha_get_group_invite_code
Retrieve WhatsApp group invite codes to share access with participants. Provide the group ID to generate a reusable invitation link for group management.
Instructions
Get group invite link.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | Group ID (format: number@g.us) |
Implementation Reference
- src/index.ts:2263-2280 (handler)Main MCP tool handler that validates input, calls the WAHA client, and formats the response with the invite code.private async handleGetGroupInviteCode(args: any) { const groupId = args.groupId; if (!groupId) { throw new Error("groupId is required"); } const result = await this.wahaClient.getGroupInviteCode(groupId); return { content: [ { type: "text", text: `Group ${groupId} invite link:\n${result.inviteCode}`, }, ], }; }
- src/client/waha-client.ts:1093-1103 (helper)WAHA API client method that performs the HTTP GET request to retrieve the group invite code.async getGroupInviteCode(groupId: string): Promise<{ inviteCode: string }> { if (!groupId) { throw new WAHAError("groupId is required"); } const endpoint = `/api/${this.session}/groups/${encodeURIComponent(groupId)}/invite-code`; return this.request<{ inviteCode: string }>(endpoint, { method: "GET", }); }
- src/index.ts:771-782 (schema)Tool schema definition including name, description, and input schema requiring groupId.name: "waha_get_group_invite_code", description: "Get group invite link.", inputSchema: { type: "object", properties: { groupId: { type: "string", description: "Group ID (format: number@g.us)", }, }, required: ["groupId"], },
- src/index.ts:1119-1120 (registration)Tool registration in the MCP CallToolRequestSchema switch statement dispatching to the handler.case "waha_get_group_invite_code": return await this.handleGetGroupInviteCode(args);