send_audio
Send audio messages via WhatsApp Business API by providing recipient details and audio source. Enables voice communication and media sharing in business conversations.
Instructions
Send an audio message.
Args: to: Phone number or WhatsApp ID audio: Audio URL or media ID reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| audio | Yes | ||
| reply_to_message_id | No |
Implementation Reference
- tools/messaging.py:182-212 (handler)Complete implementation of send_audio tool handler - sends audio messages to WhatsApp users with support for audio URL/media ID and optional reply-to functionality@mcp.tool() async def send_audio( to: str, audio: str, *, reply_to_message_id: Optional[str] = None, ) -> dict: """ Send an audio message. Args: to: Phone number or WhatsApp ID audio: Audio URL or media ID reply_to_message_id: Message ID to reply to Returns: Dictionary with success status and message ID """ try: result = wa_client.send_audio( to=to, audio=audio, reply_to_message_id=reply_to_message_id, ) logger.info(f"Audio sent to {to}") message_id = getattr(result, 'id', str(result)) if result else None return {"success": True, "message_id": message_id} except Exception as e: logger.error(f"Failed to send audio: {str(e)}") return {"success": False, "error": str(e)}
- tools/messaging.py:182-182 (registration)Tool registration using @mcp.tool() decorator that exposes send_audio as an MCP tool@mcp.tool()