Skip to content

[Bug]: WhatsApp adapter missing send_voice() override β€” voice messages sent as textΒ #4979

@veloguardian

Description

@veloguardian

Description

The WhatsApp platform adapter (gateway/platforms/whatsapp.py) does not override send_voice() from the base class. The base class fallback sends the audio file path as plain text (e.g. πŸ”Š Audio: /path/to/file.ogg) instead of delivering it as a native voice message.

All other media methods (send_image, send_image_file, send_video, send_document) are properly overridden and call _send_media_to_bridge(), but send_voice was missed.

Steps to Reproduce

  1. Use TTS (e.g. Edge provider) to generate a voice reply on WhatsApp
  2. The user receives a text message with the file path instead of a playable voice note

Expected Behavior

Voice messages should be delivered as native WhatsApp audio/voice notes, same as other platforms (Telegram works correctly).

Fix

Add the following override to WhatsAppAdapter in gateway/platforms/whatsapp.py:

async def send_voice(
    self,
    chat_id: str,
    audio_path: str,
    caption: Optional[str] = None,
    reply_to: Optional[str] = None,
    **kwargs,
) -> SendResult:
    """Send an audio file as a native WhatsApp voice message via bridge."""
    return await self._send_media_to_bridge(chat_id, audio_path, "audio", caption)

This is a 3-line fix. Similar to #4339 (Matrix missing voice support).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium β€” degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/whatsappWhatsApp Business adaptersweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions