Skip to main content
Glama
Jem-HR
by Jem-HR

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
NameRequiredDescriptionDefault
toYes
audioYes
reply_to_message_idNo

Implementation Reference

  • 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)}
  • Tool registration using @mcp.tool() decorator that exposes send_audio as an MCP tool
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jem-HR/pywa-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server