send_reaction
Send emoji reactions to WhatsApp messages using the WhatsApp Business API. React to specific messages by providing phone number, emoji, and message ID.
Instructions
Send a reaction to a message.
Args: to: Phone number or WhatsApp ID emoji: Reaction emoji message_id: ID of message to react to sender: Optional sender phone ID
Returns: Dictionary with success status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| emoji | Yes | ||
| message_id | Yes | ||
| sender | No |
Implementation Reference
- tools/messaging.py:364-397 (handler)The send_reaction tool handler function decorated with @mcp.tool() that implements the reaction sending logic. It takes parameters (to, emoji, message_id, optional sender) and calls wa_client.send_reaction(), returning a success/error dictionary.@mcp.tool() async def send_reaction( to: str, emoji: str, message_id: str, *, sender: Optional[str] = None, ) -> dict: """ Send a reaction to a message. Args: to: Phone number or WhatsApp ID emoji: Reaction emoji message_id: ID of message to react to sender: Optional sender phone ID Returns: Dictionary with success status """ try: result = wa_client.send_reaction( to=to, emoji=emoji, message_id=message_id, sender=sender, ) logger.info(f"Reaction sent to message {message_id}") result_data = str(result) if result else None return {"success": True, "result": result_data} except Exception as e: logger.error(f"Failed to send reaction: {str(e)}") return {"success": False, "error": str(e)}
- tools/__init__.py:14-18 (registration)The register_all_tools function that registers all tools including send_reaction by calling register_messaging_tools, which is invoked from server.py during server initialization.def register_all_tools(mcp, wa_client): """Register all available tools with the MCP server.""" register_messaging_tools(mcp, wa_client) register_interactive_tools(mcp, wa_client) register_template_tools(mcp, wa_client)
- server.py:62-69 (registration)Server initialization code that creates the WhatsApp client and registers all tools (including send_reaction) by calling register_all_tools(mcp, client).# Initialize WhatsApp client and register tools on startup try: client = get_whatsapp_client() logger.info("WhatsApp client configuration validated") # Register all tools from modules register_all_tools(mcp, client) logger.info("All tools registered successfully")