whatsapp_send_reaction
Send an emoji reaction to a specific WhatsApp message by providing the message ID, chat ID, sender ID, and desired emoji. This allows users to express quick responses to messages in WhatsApp conversations.
Instructions
Send a reaction (emoji) to a specific message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messageId | Yes | ID of the message to react to | |
| reaction | Yes | Emoji reaction to send (max 10 characters) | |
| senderId | Yes | ID of the original message sender | |
| to | Yes | Chat ID where the message is located |
Input Schema (JSON Schema)
{
"properties": {
"messageId": {
"description": "ID of the message to react to",
"type": "string"
},
"reaction": {
"description": "Emoji reaction to send (max 10 characters)",
"type": "string"
},
"senderId": {
"description": "ID of the original message sender",
"type": "string"
},
"to": {
"description": "Chat ID where the message is located",
"type": "string"
}
},
"required": [
"messageId",
"to",
"senderId",
"reaction"
],
"type": "object"
}
Implementation Reference
- src/tools/messaging.ts:305-353 (handler)The ToolHandler implementation for 'whatsapp_send_reaction', defining the tool metadata, input schema (embedded), and async handler that validates input and sends the reaction via WSAPI.export const sendReactionMessage: ToolHandler = { name: 'whatsapp_send_reaction', description: 'Send a reaction (emoji) to a specific message.', inputSchema: { type: 'object', properties: { messageId: { type: 'string', description: 'ID of the message to react to', }, to: { type: 'string', description: 'Chat ID where the message is located', }, senderId: { type: 'string', description: 'ID of the original message sender', }, reaction: { type: 'string', description: 'Emoji reaction to send (max 10 characters)', }, }, required: ['messageId', 'to', 'senderId', 'reaction'], }, handler: async (args: any) => { const input = validateInput(sendReactionMessageSchema, args) as SendReactionMessageInput; logger.info('Sending reaction', { messageId: input.messageId, to: input.to, reaction: input.reaction, }); const result = await wsapiClient.post(`/messages/${input.messageId}/reaction`, { to: input.to, senderId: input.senderId, reaction: input.reaction, }); logger.info('Reaction sent successfully', { messageId: result.id }); return { success: true, messageId: result.id, message: 'Reaction sent successfully', }; }, };
- src/validation/schemas.ts:119-124 (schema)Zod schema used for validating input to the whatsapp_send_reaction tool handler.export const sendReactionMessageSchema = z.object({ messageId: messageIdSchema, to: chatIdSchema, senderId: phoneNumberSchema, reaction: z.string().min(1).max(10), // Emoji });
- src/server.ts:53-79 (registration)Registration logic in the MCP server that imports and registers all tools from messagingTools (which includes whatsapp_send_reaction) into the tool 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`); }
- src/server.ts:15-16 (registration)Import of messagingTools which contains the whatsapp_send_reaction handler.import { messagingTools } from './tools/messaging.js'; import { contactTools } from './tools/contacts.js';
- src/tools/messaging.ts:544-555 (registration)Export of messagingTools object that bundles the sendReactionMessage handler for registration in the server.export const messagingTools = { sendTextMessage, sendImageMessage, sendVideoMessage, sendLinkMessage, sendReactionMessage, editMessage, deleteMessage, markMessageAsRead, starMessage, ...advancedMessagingTools, };