← ClaudeAtlas

tg-rich-streaminglisted

Use when streaming LLM or AI-generated replies to Telegram in real time (ChatGPT-style progressive output in a bot), showing a model thinking indicator, or delivering token-by-token text as an animated rich message draft that finalizes into a permanent message.
serejaris/telegram-skills · ★ 41 · AI & Automation · score 87
Install: claude install-skill serejaris/telegram-skills
# tg-rich-streaming Stream AI-generated text into a Telegram private chat with native draft animation and a "thinking" indicator — the same UX as ChatGPT or Claude, directly inside the bot. Sending requires network access to `api.telegram.org` and `TELEGRAM_BOT_TOKEN`. Checked against the official docs on 2026-10-30: Bot API 10.3 (latest, August 24, 2026). Nothing here was run against a live bot. | Method | Content | Since | Finalize with | |---|---|---|---| | `sendMessageDraft` | plain `text` 0–4096, `parse_mode` or `entities`; empty `text` shows a "Thinking…" placeholder | 9.3, all bots since 9.5 | `sendMessage` | | `sendRichMessageDraft` | `InputRichMessage`, including `<tg-thinking>` | 10.1 | `sendRichMessage` | Both work only with a private integer `chat_id`. Both take `draft_id`, `message_thread_id`, `can_stop` and `keep_on_stop`, and both drafts live 30 seconds. Bot API 10.2 also permits direct `InputRichMessage.blocks`; the draft lifecycle below is unchanged. A rich draft can't upload new files or upload by URL, so media in a draft must already have a `file_id`. ## Core pattern Four mandatory steps. Skip step 3 and the draft disappears after ~30 seconds. ### Step 1 — open draft with Thinking block Send the first `sendRichMessageDraft` immediately after the LLM call starts. `draft_id` is any non-zero integer you generate once per response; keep it for all updates. `RichBlockThinking` signals the model is working. ``` POST /sendRichMessageDraft { "chat_id": <