Skip to content

Feishu: Support native voice message bubbles (OGG/Opus) for TTS #61249

Description

@sg1416-zg

Description

Currently when using OpenClaw built-in TTS (Edge TTS) to generate audio and send via Feishu, the audio is sent as an MP3 file attachment instead of a native Feishu voice bubble.

Root Cause

Feishu API requires OGG/Opus format for native voice messages, but Edge TTS generates MP3.

Solution

Modify 5 files in openclaw-lark extension to auto-convert MP3 to OGG/Opus and send as native voice bubble.

1. messaging/outbound/media.js

  • Add convertMp3ToOgg() using FFmpeg with libopus codec 64k
  • In uploadAndSendMediaLark: detect .mp3, convert to .ogg, set isVoiceAudio=true
  • In fetchMediaBuffer: add /tmp and backslash-tmp to defaultRoots for Windows compat
  • Use sendAudioLark() for isVoiceAudio+isAudio cases

2. messaging/outbound/actions.js

  • Extract asVoice from params (asVoice or audioAsVoice)
  • Pass through deliverMessage and deliverMedia

3. messaging/outbound/deliver.js

  • Accept and forward asVoice parameter to uploadAndSendMediaLark

4. messaging/outbound/outbound.js

  • Add resolveMediaLocalRoots() with os.tmpdir() fallback
  • Forward mediaLocalRoots and asVoice in sendMedia/sendPayload

5. card/reply-dispatcher.js

  • Add mediaLocalRoots and asVoice in both streaming and static deliver paths

FFmpeg

FFmpeg is required for conversion. Windows install via winget install ffmpeg.

Call Chain

TTS MP3 -> reply-dispatcher -> deliver.js -> media.js (convertMp3ToOgg) -> sendAudioLark -> Feishu voice bubble

Impact

  • Native Feishu voice bubbles for all TTS content
  • No breaking changes (graceful fallback to file attachment)
  • Tested on openclaw-lark 2026.3.31 Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions