whatsapp_pin_chat
Pin or unpin WhatsApp chats to organize important conversations and keep them easily accessible at the top of your chat list.
Instructions
Pin or unpin a chat.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID | |
| pinned | Yes | Whether to pin or unpin |
Input Schema (JSON Schema)
{
"properties": {
"chatId": {
"description": "Chat ID",
"type": "string"
},
"pinned": {
"description": "Whether to pin or unpin",
"type": "boolean"
}
},
"required": [
"chatId",
"pinned"
],
"type": "object"
}
Implementation Reference
- src/tools/chats.ts:70-86 (handler)The complete ToolHandler implementation for 'whatsapp_pin_chat', defining name, description, input schema, and the async handler function that validates input and calls the WSAPI endpoint to pin or unpin a chat.export const pinChat: ToolHandler = { name: 'whatsapp_pin_chat', description: 'Pin or unpin a chat.', inputSchema: { type: 'object', properties: { chatId: { type: 'string', description: 'Chat ID' }, pinned: { type: 'boolean', description: 'Whether to pin or unpin' }, }, required: ['chatId', 'pinned'], }, handler: async (args: any) => { const input = validateInput(updateChatPinSchema, args); await wsapiClient.put(`/chats/${input.chatId}/pin`, { pinned: input.pinned }); return { success: true, message: `Chat ${input.pinned ? 'pinned' : 'unpinned'} successfully` }; }, };
- src/validation/schemas.ts:244-247 (schema)Zod schema (updateChatPinSchema) used for input validation in the whatsapp_pin_chat handler.export const updateChatPinSchema = z.object({ chatId: chatIdSchema, pinned: z.boolean(), });
- src/server.ts:53-79 (registration)Server method setupToolHandlers() that registers all tools, including those from chatTools (containing whatsapp_pin_chat), by iterating over toolCategories and adding them to the server's tools Map.private setupToolHandlers(): void { logger.info('Setting up tool handlers'); // Register all tool categories 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`); }