Repository navigation
Closed
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttheme-channelsTheme: Channelstype-featureNew functionality
Description
Problem
src/backend/adapters/telegram_adapter.py:681-682 detects Telegram voice messages and returns a static placeholder:
[User sent a voice message — voice transcription is not yet available]
Users who prefer voice — common on mobile, accessibility, non-English typists — are effectively blocked from using Telegram-shared agents. The bot silently drops the content of every voice note.
Proposed approach
Transcribe voice messages with OpenAI Whisper before they hit the agent, so from the agent's perspective a voice note is just another text message.
Flow:
- Adapter sees
message.voicein a Telegram update telegram_media.pydownloads the OGG/Opus file (reuse existing 20MB + SSRF guards)- New
services/transcription_service.pyPOSTs to Whisper API (/v1/audio/transcriptions,model=whisper-1) - Adapter substitutes the transcript for the placeholder, optionally prefixed (e.g.
🎙️ "<transcript>") so the agent knows the original was spoken - Failures (rate limit, oversize, API down) → fall back to the current placeholder with the error reason
What's actually new
services/transcription_service.py— thin Whisper client with retries- Extend
services/telegram_media.pyto handlevoiceandaudiopayloads - Replace the placeholder in
telegram_adapter.py:681 - Platform setting
OPENAI_API_KEY(reusesettings_service.py) — per-platform, not per-agent, since voice is a platform capability
Open questions
- Cost attribution: Whisper is ~$0.006/min. Count against the agent's cost or platform overhead? Leaning platform, logged per-agent.
- Language detection: Whisper auto-detects. Should we expose a per-binding
language_hintfor noisy environments? - Video notes (
video_note): same pipeline? Extract audio track, then transcribe.
Out of scope
- ElevenLabs / TTS reply (tracked separately)
- Proactive messaging (tracked separately)
- Non-Telegram channels (Slack, web) — same approach will apply later but not in this issue
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p2Importanttheme-channelsTheme: Channelstype-featureNew functionality
Activity
m13v commentedon Apr 13, 2026
we built exactly this pipeline for voice input in a macOS agent. the Whisper API approach is fine for the happy path, but two things to watch for: Telegram voice messages are OGG/Opus with variable bitrates, and Whisper expects specific audio formats (16kHz mono WAV/FLAC). you need an ffmpeg or pydub conversion step before hitting the API, otherwise you get garbled transcriptions on longer messages. the other gotcha is cost attribution as you mentioned. we ended up capping voice transcription at 2 minutes per message and returning a truncation notice for anything longer. most voice notes are under 30 seconds anyway, so the cap rarely triggers. for the failure fallback, include the file duration in the error placeholder so users know their 5-minute voice novel was too long.
m13v commentedon Apr 13, 2026
our voice transcription pipeline that handles audio format conversion, model loading, and the chunked processing flow: https://github.com/m13v/fazm/blob/main/Desktop/Sources/TranscriptionService.swift
feat(telegram): voice transcription via Gemini (#318)
feat(telegram): voice transcription via Gemini (#318) (#401)