← Back to PRs

#15351: feat(feishu): Add native audio message support (voice bubble)

by lovejing0306 open 2026-02-13 09:53 View on GitHub →
channel: feishu stale size: S
## Summary Add support for sending native voice messages (audio bubbles) in Feishu instead of file attachments. ## Problem Currently, when sending audio files via the Feishu plugin, they are sent as file attachments (`msg_type: "file"` or `msg_type: "media"`) instead of native voice messages (`msg_type: "audio"`). This results in a poor user experience as users see a file download link instead of a playable voice bubble with duration indicator. ## Solution 1. **Add `sendAudioFeishu` function**: A new function that sends audio messages using `msg_type: "audio"`, which displays as a native voice bubble in Feishu client. 2. **Modify `sendMediaFeishu`**: Updated to detect audio files (`.opus`, `.ogg`) and route them to `sendAudioFeishu` instead of `sendFileFeishu`. 3. **Separate media type handling**: - Audio files (`.opus`, `.ogg`) → `msg_type: "audio"` (voice bubble) - Video files (`.mp4`, `.mov`, `.avi`) → `msg_type: "media"` (video player) - Other files → `msg_type: "file"` (file attachment) ## Testing Tested with: - Edge TTS generated audio converted to opus format - Various audio lengths (3s to 68s) - Successfully displays as native voice bubble in Feishu client (desktop and mobile) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a dedicated `sendAudioFeishu` path that sends Feishu `msg_type: "audio"` messages (voice bubble UI) and updates `sendMediaFeishu` to route `.opus`/`.ogg` through this audio path, while routing common video extensions through `msg_type: "media"` and leaving other files as `msg_type: "file"`. The change fits the existing media module pattern: upload via `im.file.create` / `im.image.create`, then send via `im.message.create` (or `reply`) using the returned key. The new logic mainly affects how audio is uploaded/sent and removes the prior `fileType === "opus" => msg_type: "media"` behavior in favor of a native audio message. <h3>Confidence Score: 3/5</h3> - This PR is close to mergeable but has a likely Feishu API contract mismatch for audio uploads. - Core routing logic is straightforward and consistent with existing send paths, but the new audio upload path appears to omit required metadata (`duration`) and may mislabel `.ogg` content as `opus`, which can cause send/upload failures in real use. - extensions/feishu/src/media.ts <sub>Last reviewed commit: 5f8ca8e</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs