#15394: telegram: treat mp3 as voice-compatible when asVoice=true
channel: telegram
stale
size: XS
Cluster:
Voice Message Enhancements
Summary
This PR makes Telegram treat MP3 as voice-compatible when asVoice=true, so messages are sent as voice notes (sendVoice) instead of regular audio files (sendAudio).
Problem:
Currently, voice compatibility accepts only OGG/OPUS (.oga/.ogg/.opus and ogg/opus mime).
Common TTS output is MP3, so asVoice=true can fall back to audio file behavior.
Change
Added .mp3 to VOICE_AUDIO_EXTENSIONS
Extended mime compatibility check to include
[SNIPPETS-BEFORE-AFTER.md](https://github.com/user-attachments/files/25288803/SNIPPETS-BEFORE-AFTER.md)
mp3
Why
This improves UX consistency: when voice is requested, Telegram receives a voice note bubble.
Validation
Reproduced on OpenClaw 2026.2.12
Before: asVoice=true + mp3 -> sendAudio
After: asVoice=true + mp3 -> sendVoice
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change expands `isVoiceCompatibleAudio` (`src/media/audio.ts`) to treat MP3 (`.mp3` / MIME containing `mp3`) as “voice-compatible”, which makes Telegram’s `asVoice=true` decision route MP3 audio through `sendVoice` instead of `sendAudio`.
The main follow-up needed before merge is updating the Telegram unit test(s) that currently encode the old behavior (MP3 not voice-compatible), otherwise the test suite will no longer match the new intended routing.
<h3>Confidence Score: 3/5</h3>
- This PR is small and localized, but it requires updating existing Telegram tests that will now be incorrect.
- The implementation change is straightforward (extension + MIME substring check), but an existing unit test explicitly expects MP3 to fall back to sendAudio; without test updates the PR will be inconsistent with repo expectations. Tooling limitations in this environment prevented running the test suite to confirm.
- src/telegram/send.returns-undefined-empty-input.test.ts (and any other Telegram send tests asserting MP3 fallback)
<sub>Last reviewed commit: 1450c17</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
#21193: fix(tts): send voice messages as Opus bubbles on Telegram
by aris-katkova · 2026-02-19
81.2%
#12700: fix(tts): deliver WhatsApp voice as opus bubble instead of MP3 (#12...
by lailoo · 2026-02-09
79.1%
#13389: feat(telegram): support native voice notes with automatic OGG/Opus ...
by leavingme · 2026-02-10
78.0%
#14227: fix(matrix): pass asVoice to audioAsVoice for native voice messages
by tfm-neo-ai · 2026-02-11
74.7%
#7902: feat: Implement Telegram video note support with tests and docs
by thewulf7 · 2026-02-03
74.5%
#23572: feat(voice): enable voice note conversation loop for Telegram and W...
by davidrudduck · 2026-02-22
74.5%
#17120: fix: transcribe all Telegram voice messages, not just mention-gated...
by MisterGuy420 · 2026-02-15
73.9%
#19439: fix(tts): pass audioAsVoice flag through tool result pipeline
by brandonwise · 2026-02-17
73.8%
#22434: feat(telegram): support sending original quality images
by godenjan · 2026-02-21
72.9%
#23067: feat(telegram): add disableAudioPreflight config for groups and topics
by yangnim21029 · 2026-02-22
72.9%