Skip to content

Telegram: use sendMessageDraft (Bot API 9.3) for faster streaming #32180

@QuarkAssistant

Description

@QuarkAssistant

Summary

Telegram Bot API 9.3 (Dec 31, 2025) introduced sendMessageDraft — a purpose-built method for streaming partial messages during generation. As of Bot API 9.5 (March 1, 2026), it's available to all bots.

Currently, OpenClaw's Telegram draft streaming uses the editMessageText approach: send a message, then repeatedly edit it as tokens arrive. This works but is throttled to ~1 update/second (DEFAULT_THROTTLE_MS = 1000 in src/telegram/draft-stream.ts) to stay within Telegram's rate limits on edits.

Request

Evaluate adopting sendMessageDraft as the streaming transport for Telegram channels when streaming: "partial" is configured. Since this is a dedicated streaming method (not a message edit), it may support faster update intervals than the current editMessageText workaround.

Additionally, consider exposing throttleMs as a configurable option under channels.telegram (e.g., channels.telegram.streamThrottleMs) so users can tune the tradeoff between responsiveness and rate-limit safety.

Context

Current behavior

  • src/telegram/draft-stream.ts uses sendMessage + editMessageText loop
  • DEFAULT_THROTTLE_MS = 1000 (hardcoded, not configurable)
  • TELEGRAM_STREAM_MAX_CHARS = 4096
  • Config channels.telegram.streaming: "partial" enables draft streaming but throttle is not tunable

Environment

  • OpenClaw v2026.3.1
  • Node 22.22.0
  • macOS (LaunchAgent gateway)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions