hermes - 💡(How to fix) Fix feat(telegram): streaming reply via sendMessageDraft (Bot API 9.5+)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
RAW_BUFFERClick to expand / collapse

Is your feature request related to a problem?

Yes. When using a slow model (e.g. o1, deepseek-r1), the user sees nothing for 10-30+ seconds before the full reply appears at once. The current streaming: true implementation uses editMessageText polling, which causes visible flickering and feels sluggish compared to native Telegram typing indicators.

Describe the solution you'd like

Telegram Bot API 9.5+ supports sendMessageDraft for all bots. This method streams partial message text to the user in real-time, appearing as a "typing" draft that updates smoothly — similar to how the native Telegram AI assistant works.

Proposed implementation:

  1. On first token: call sendMessageDraft with partial text
  2. On subsequent tokens: call sendMessageDraft again to update the draft
  3. On completion: call sendMessage with the full message (replacing the draft)
  4. Falls back to existing editMessageText if sendMessageDraft fails

This would provide a much smoother streaming experience on Telegram, especially for slow models.

Describe alternatives you've considered

Current editMessageText polling with edit_interval — works but causes visible flickering and re-rendering on each edit.

Additional context

  • python-telegram-bot already supports sendMessageDraft since v22.x
  • Prior PRs (#17179, #1312, #922, #774) attempted similar streaming approaches but were closed — this proposal specifically targets sendMessageDraft which is now available to all bots as of API 9.5
  • Reference: Telegram Bot API - sendMessageDraft

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix feat(telegram): streaming reply via sendMessageDraft (Bot API 9.5+)