whatsapp_set_chat_presence
Update your presence status in WhatsApp chats to show typing, recording, or paused states, enabling real-time communication feedback.
Instructions
Set presence status in a chat (typing, recording, paused).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID | |
| state | Yes | Presence state |
Implementation Reference
- src/tools/chats.ts:34-50 (handler)Core implementation of the 'whatsapp_set_chat_presence' tool handler. Defines the tool metadata, inline input schema, performs validation using the dedicated Zod schema, makes a PUT request to the WSAPI to set the chat presence, and returns success response.export const setChatPresence: ToolHandler = { name: 'whatsapp_set_chat_presence', description: 'Set presence status in a chat (typing, recording, paused).', inputSchema: { type: 'object', properties: { chatId: { type: 'string', description: 'Chat ID' }, state: { type: 'string', enum: ['typing', 'recording', 'paused'], description: 'Presence state' }, }, required: ['chatId', 'state'], }, handler: async (args: any) => { const input = validateInput(setChatPresenceSchema, args); await wsapiClient.put(`/chats/${input.chatId}/presence`, { state: input.state }); return { success: true, message: 'Chat presence updated successfully' }; }, };
- src/validation/schemas.ts:229-232 (schema)Zod schema for input validation specific to the whatsapp_set_chat_presence tool, defining chatId and state (typing/recording/paused). Used in the handler's validateInput call.export const setChatPresenceSchema = z.object({ chatId: chatIdSchema, state: z.enum(['typing', 'recording', 'paused']), });
- src/server.ts:57-78 (registration)Registration logic in the MCP server setup. Includes chatTools (containing setChatPresence) in toolCategories array and iterates to register each tool by name in the server's tools Map.const toolCategories = [ messagingTools, contactTools, groupTools, chatTools, sessionTools, instanceTools, accountTools, ]; toolCategories.forEach(category => { Object.values(category).forEach(tool => { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); return; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); }); }); logger.info(`Registered ${this.tools.size} tools`);
- src/server.ts:18-18 (registration)Import of chatTools object (which exports setChatPresence handler) necessary for registration.import { chatTools } from './tools/chats.js';