start_session
Reactivate a stopped WhatsApp session to restore its active status and enable messaging operations.
Instructions
Start a stopped WhatsApp session to make it active
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID of the session to start |
Implementation Reference
- src/tools/sessions.ts:32-44 (handler)Registration and handler for the 'start_session' tool. Calls POST /sessions/{sessionId}/start via openwaClient to start a stopped WhatsApp session.
server.registerTool( "start_session", { description: "Start a stopped WhatsApp session to make it active", inputSchema: { sessionId: z.string().describe("ID of the session to start"), }, }, async ({ sessionId }) => { const data = await openwaClient({ method: "POST", path: `/sessions/${sessionId}/start` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } ); - src/tools/sessions.ts:34-38 (schema)Input schema for start_session: requires a 'sessionId' string describing the ID of the session to start.
{ description: "Start a stopped WhatsApp session to make it active", inputSchema: { sessionId: z.string().describe("ID of the session to start"), }, - src/index.ts:15-15 (registration)Registration call: registerSessionTools(server) registers all session tools including 'start_session' on the MCP server.
registerSessionTools(server); - src/client.ts:10-30 (helper)Helper function openwaClient used by the handler to make HTTP requests to the OpenWA API.
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 {