get_group_info
Retrieve detailed WhatsApp group information including members, admins, and settings by providing a session and group ID.
Instructions
Get detailed information about a specific WhatsApp group including members, admins, and settings
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session ID | |
| groupId | Yes | Group ID |
Implementation Reference
- src/tools/groups.ts:41-53 (handler)The 'get_group_info' tool handler function. It registers the tool via server.registerTool with input schema (sessionId, groupId) and makes a GET request to /sessions/{sessionId}/groups/{groupId} via the openwaClient helper.
"get_group_info", { description: "Get detailed information about a specific WhatsApp group including members, admins, and settings", inputSchema: { sessionId: z.string().describe("Session ID"), groupId: z.string().describe("Group ID"), }, }, async ({ sessionId, groupId }) => { const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/groups/${groupId}` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } ); - src/tools/groups.ts:40-52 (registration)The tool registration call for 'get_group_info' using server.registerTool with name, description, input schema, and handler.
server.registerTool( "get_group_info", { description: "Get detailed information about a specific WhatsApp group including members, admins, and settings", inputSchema: { sessionId: z.string().describe("Session ID"), groupId: z.string().describe("Group ID"), }, }, async ({ sessionId, groupId }) => { const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/groups/${groupId}` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } - src/tools/groups.ts:42-47 (schema)Input schema definition for get_group_info, specifying sessionId (string) and groupId (string) as required parameters.
{ description: "Get detailed information about a specific WhatsApp group including members, admins, and settings", inputSchema: { sessionId: z.string().describe("Session ID"), groupId: z.string().describe("Group ID"), }, - src/client.ts:10-35 (helper)openwaClient helper function that makes HTTP requests to the OpenWA API. Used by the get_group_info handler to fetch group data.
export async function openwaClient<T = unknown>(opts: RequestOptions): Promise<T> { const url = `${BASE_URL}${opts.path}`; const headers: Record<string, string> = { "Content-Type": "application/json", "X-API-Key": API_KEY, }; const res = await fetch(url, { method: opts.method, headers, body: opts.body ? JSON.stringify(opts.body) : undefined, }); const text = await res.text(); if (!res.ok) { throw new Error(`OpenWA API ${res.status}: ${text}`); } try { return JSON.parse(text) as T; } catch { return text as T; } }