waha_unpin_message
Remove a pinned message from a WhatsApp chat to clear the pinned message slot and manage chat organization.
Instructions
Unpin a message in a chat.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID (format: number@c.us) | |
| messageId | Yes | Message ID to unpin |
Implementation Reference
- src/index.ts:239-256 (registration)Tool registration and schema definition in the ListToolsRequestSchema handler. Defines name, description, and input schema (chatId and messageId required).{ name: "waha_unpin_message", description: "Unpin a message in a chat.", inputSchema: { type: "object", properties: { chatId: { type: "string", description: "Chat ID (format: number@c.us)", }, messageId: { type: "string", description: "Message ID to unpin", }, }, required: ["chatId", "messageId"], }, },
- src/index.ts:1437-1461 (handler)MCP tool handler function. Validates input parameters (chatId, messageId), calls the WAHA client unpinMessage method, and returns success message.* Handle waha_unpin_message tool */ private async handleUnpinMessage(args: any) { const chatId = args.chatId; const messageId = args.messageId; if (!chatId) { throw new Error("chatId is required"); } if (!messageId) { throw new Error("messageId is required"); } await this.wahaClient.unpinMessage(chatId, messageId); return { content: [ { type: "text", text: `Successfully unpinned message ${messageId} from chat ${chatId}.`, }, ], }; }
- src/index.ts:1064-1067 (registration)Tool dispatch registration in the CallToolRequestSchema switch statement. Routes calls to waha_unpin_message to the handleUnpinMessage handler.return await this.handlePinMessage(args); case "waha_unpin_message": return await this.handleUnpinMessage(args); case "waha_clear_chat_messages":
- src/client/waha-client.ts:395-411 (helper)Underlying WAHA client method that performs the actual HTTP POST request to unpin the message via the WAHA API endpoint.async unpinMessage(chatId: string, messageId: string): Promise<void> { if (!chatId) { throw new WAHAError("chatId is required"); } if (!messageId) { throw new WAHAError("messageId is required"); } const endpoint = `/api/${this.session}/chats/${encodeURIComponent( chatId )}/messages/${encodeURIComponent(messageId)}/unpin`; await this.request<void>(endpoint, { method: "POST", }); }