Skip to content

feat(telegram): hand off audio/document files to the agent - #183

Open
AuYahyire wants to merge 4 commits into
owainlewis:mainfrom
AuYahyire:feat/telegram-audio-document-handoff
Open

feat(telegram): hand off audio/document files to the agent#183
AuYahyire wants to merge 4 commits into
owainlewis:mainfrom
AuYahyire:feat/telegram-audio-document-handoff

Conversation

@AuYahyire

@AuYahyire AuYahyire commented Aug 3, 2026

Copy link
Copy Markdown

Summary

  • Telegram audio messages and audio document files (long recordings) were ignored as empty_message because Push only accepted text or voice notes.
  • Those attachments are now downloaded to $PUSH_HOME/cache/inbound-audio/ and handed to the agent with a short local-transcription prompt (no OpenAI STT, no spoken reply).
  • Captions are preserved. Non-audio documents stay ignored.
  • When telegram-bot-api runs with --local, getFile may return an absolute filesystem path that 404s over HTTP; absolute paths are read from disk instead.

Why

Long phone recordings arrive as audio / document, not voice. Operators who want local transcription skills need Push to accept and download those files and pass the path to the agent, without pulling cloud STT into the gateway.

Test plan

  • cargo fmt --all --check
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo build --locked
  • cargo test --locked
  • cargo test parses_audio_and_audio_documents
  • cargo test parses_voice_attachment
  • Send a long audio/document to the bot → file under ~/.push/cache/inbound-audio/ and agent starts local transcription
  • Voice notes still use the existing cloud STT path when [voice] is configured
  • Non-audio documents are still ignored

Risks

Related issue

None (depends on #181)

github-actions Bot and others added 4 commits August 2, 2026 17:23
Allow self-hosted telegram-bot-api endpoints and larger voice downloads
while keeping public api.telegram.org defaults unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
Long recordings arrive as Telegram audio or documents, not voice notes, and
were ignored as empty_message. Download them to $PUSH_HOME/cache/inbound-audio
and pass the path to the agent for local transcription instead of cloud STT.

Co-authored-by: Cursor <cursoragent@cursor.com>
getFile returns absolute paths under telegram-bot-api --local; HTTP
/file/bot… 404s for those paths. Read absolute paths with std::fs instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant