openclaw - 💡(How to fix) Fix [Feature]: Telegram saveMessage API support for native streaming replies [1 participants]

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…
GitHub stats
openclaw/openclaw#63341Fetched 2026-04-09 07:55:09
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1labeled ×1

Add support for Telegram Bot API 9.8 saveMessage method to stream bot replies character-by-character instead of the current sendMessage + editMessageText approach.

Root Cause

Add support for Telegram Bot API 9.8 saveMessage method to stream bot replies character-by-character instead of the current sendMessage + editMessageText approach.

RAW_BUFFERClick to expand / collapse

Summary

Add support for Telegram Bot API 9.8 saveMessage method to stream bot replies character-by-character instead of the current sendMessage + editMessageText approach.

Problem to solve

OpenClaw currently uses streaming: "partial" which works by sending an initial sendMessage and then repeatedly calling editMessageText to update the text as tokens arrive. This causes:

• Duplicate messages due to race conditions with generation counter (#39795) • Stuck streaming state where subsequent messages trigger message_start errors (#55399) • Visual artifacts — message flickers, old text deleted and new one appears, poor UX compared to native streaming • Rate limit pressure — each edit is a separate API call

Proposed solution

Replace the current sendMessage → editMessageText loop with Telegram's new saveMessage API:

  1. Call saveMessage with initial text to create the message
  2. Call updateMessage as tokens stream in — text appears gradually in-place
  3. Final updateMessage when generation completes

This should be gated behind channels.telegram.streaming: "saveMessage" (or similar) to allow gradual rollout and backward compatibility.

Alternatives considered

• Current streaming: "partial" — works but has race conditions and visual artifacts • streaming: "off" — no streaming at all, user waits for full response. Defeats the purpose • Webhook-based custom implementation — too complex, saveMessage is the official Telegram solution

Impact

• Affected: All Telegram users with streaming: "partial" enabled • Severity: Annoying — current streaming works but is buggy • Frequency: Every streamed response has potential for duplicate messages or stuck state • Consequence: Confusing UX, extra API calls, occasional broken message flow

Evidence/examples

• Telegram Bot API 9.8 changelog: saveMessage + updateMessage methods • Telegram Desktop 6.7.5 release notes: "Support for gradual appearing of bot reply messages" • Related bugs: #39795, #55399, #44598

Additional information

The saveMessage API is very new (April 2026). Desktop client already supports rendering. Mobile clients likely coming soon. This would make OpenClaw one of the first bot frameworks to adopt native streaming.

extent analysis

TL;DR

Implement the proposed solution by replacing the current sendMessage and editMessageText loop with Telegram's new saveMessage and updateMessage API to improve streaming functionality.

Guidance

  • Replace the existing streaming logic with the saveMessage API to create the initial message and updateMessage to gradually update the text as tokens stream in.
  • Gate the new implementation behind a configuration flag, such as channels.telegram.streaming: "saveMessage", to allow for gradual rollout and backward compatibility.
  • Verify the fix by testing the new streaming functionality with different scenarios, including rapid token generation and slow network connections.
  • Monitor the frequency of duplicate messages, stuck streaming states, and visual artifacts to ensure the new implementation resolves the existing issues.

Example

# Pseudo-code example of the proposed solution
def stream_message(tokens):
    # Create the initial message using saveMessage
    message_id = saveMessage(initial_text)
    
    # Update the message as tokens stream in
    for token in tokens:
        updateMessage(message_id, token)
    
    # Final update when generation completes
    updateMessage(message_id, final_text)

Notes

The saveMessage API is a new feature in Telegram Bot API 9.8, and its adoption may require updates to the Telegram client versions used by users. The proposed solution assumes that the saveMessage and updateMessage APIs are properly implemented and functional.

Recommendation

Apply the workaround by implementing the proposed solution, as it addresses the existing issues with the current streaming approach and provides a more native and efficient way of streaming bot replies.

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