whatsapp_star_message
Mark important WhatsApp messages with a star for quick reference or remove stars from previously marked messages using message, chat, and sender IDs.
Instructions
Star or unstar a message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chatId | Yes | Chat ID where the message is located | |
| messageId | Yes | ID of the message to star | |
| senderId | Yes | ID of the message sender |
Input Schema (JSON Schema)
{
"properties": {
"chatId": {
"description": "Chat ID where the message is located",
"type": "string"
},
"messageId": {
"description": "ID of the message to star",
"type": "string"
},
"senderId": {
"description": "ID of the message sender",
"type": "string"
}
},
"required": [
"messageId",
"chatId",
"senderId"
],
"type": "object"
}
Implementation Reference
- src/tools/messaging.ts:497-538 (handler)The ToolHandler object defining the 'whatsapp_star_message' tool, including its description, inline inputSchema mirroring the Zod schema, and the handler function that logs the action, calls the WSAPI to star the message, logs success, and returns a success response.export const starMessage: ToolHandler = { name: 'whatsapp_star_message', description: 'Star or unstar a message.', inputSchema: { type: 'object', properties: { messageId: { type: 'string', description: 'ID of the message to star', }, chatId: { type: 'string', description: 'Chat ID where the message is located', }, senderId: { type: 'string', description: 'ID of the message sender', }, }, required: ['messageId', 'chatId', 'senderId'], }, handler: async (args: any) => { const input = validateInput(starMessageSchema, args); logger.info('Starring message', { messageId: input.messageId, chatId: input.chatId, }); await wsapiClient.put(`/messages/${input.messageId}/star`, { chatId: input.chatId, senderId: input.senderId, }); logger.info('Message starred successfully', { messageId: input.messageId }); return { success: true, message: 'Message starred successfully', }; }, };
- src/validation/schemas.ts:166-170 (schema)Zod validation schema for the starMessage tool inputs: messageId (string min1), chatId (union of phone or group), senderId (phone number regex). Used by validateInput in the handler.export const starMessageSchema = z.object({ messageId: messageIdSchema, chatId: chatIdSchema, senderId: phoneNumberSchema, });
- src/tools/messaging.ts:544-555 (registration)The starMessage tool is included in the messagingTools export object, which aggregates all messaging tools for registration.export const messagingTools = { sendTextMessage, sendImageMessage, sendVideoMessage, sendLinkMessage, sendReactionMessage, editMessage, deleteMessage, markMessageAsRead, starMessage, ...advancedMessagingTools, };
- src/server.ts:53-79 (registration)Server's setupToolHandlers method imports and registers all tools from messagingTools (including whatsapp_star_message) into a Map this.tools by iterating over tool categories and setting tool.name to tool.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`); }