Designing long-running Telegram bots: streaming replies, stop controls, and private topics
Turn streaming drafts, stop controls, and private-chat topics into testable requirements for Telegram search, report, and AI workflows.
A search, document-processing, or AI task that takes tens of seconds needs more than an input and a final answer. The user needs to know that work started, whether it can be stopped, and whether several ongoing jobs will share the wrong context.
Telegram exposes separate building blocks for these concerns. Streaming drafts provide visible progress, stop controls let a user withdraw an active request, and private-chat topics organize long-running conversations. These are interface and conversation-lifecycle features; they do not provide a model, memory, tools, or autonomous planning by themselves.
Treat the three components separately
| Component | What it solves | What it does not replace | | --- | --- | --- | | Streaming draft | Reduces silent waiting and shows that work is active | A persistent final message or failure recovery | | Stop control | Lets the user request cancellation and informs the bot | Automatic cancellation of external APIs, refunds, or rollback | | Private topic | Separates an order, project, or support case | Authorization or database tenant isolation |
Telegram documents a streamed text draft as a temporary private-chat preview. A regular draft is a roughly 30-second preview; the bot must still send the completed message if the result should remain in chat. Bot API 10.3, dated August 24, 2026, added stoppable drafts and an update when a user stops generation.
Private-chat topics must first be enabled for the bot through Telegram's official BotFather. A bot can create, edit, and delete topics and route messages with the relevant message-thread identifier. Topics can separate “Order 1032,” “Weekly market report,” and “Product troubleshooting,” but a topic title is not a trusted access-control boundary.
A requirement you can adapt
Start with observable behavior and an explicit fallback:
Create a long-report bot for Telegram private chats. Confirm immediately when a user submits a job and show temporary progress within that same job. When work finishes, send a persistent final message. The user can stop an active job; after that, the bot must not send another draft or final result for it. Allow each new project to have a separate private-chat topic, and keep later messages and results in the originating topic. If the runtime does not support streaming drafts, stop updates, or private topics, identify the unsupported capability and fall back to a start message, final message, and /cancel command instead of imitating native Telegram behavior. The first version does not require a paid model, arbitrary npm modules, or an external job queue.
The fallback matters. When a Bot API capability is absent from the selected SDK or hosted runtime, a correct implementation narrows its scope instead of generating a button or method that cannot work.
Keep job state separate from chat messages
Do not use “the most recent message” as job state. Store at least:
- a stable job identifier, requesting user, and message-thread identifier;
- a state such as queued, running, stopping, completed, or failed;
- the last user-visible progress point;
- whether a persistent final result has been sent;
- when cancellation was requested.
After a stop request, first prevent any later output from being published, then attempt to cancel the model request, search, or document job. An upstream service may not support immediate cancellation. “No more output is shown” and “background compute stopped” are therefore separate acceptance results.
Bound the update rate and the content of drafts
Updating on every token can waste requests and create visual flicker. Specify a meaningful-change policy, such as updating after a time interval or after enough new content has accumulated.
Progress text should describe observable phases: “Reading three sources” or “Preparing the final summary.” It should not claim to expose hidden model reasoning. Telegram explicitly describes its Thinking indicator as a presentation element, not a transcript of model reasoning.
Drafts should not expose tokens, internal stack traces, or conclusions that have not been checked. Assemble and validate the final response independently; the last draft is not automatically a durable, approved result.
Test six races and lifecycle paths
- Normal completion: the bot acknowledges the job, shows progress, and ends with a persistent final message.
- User stop: stopping during generation produces a stopped state and no late draft or final result.
- Stop-versus-complete race: if both occur together, only one terminal state wins.
- Topic isolation: jobs submitted in topics A and B keep their progress, results, and follow-ups in the correct topic.
- Restart recovery: after a restart, the bot recognizes unfinished work and follows the agreed resume, fail, or retry policy.
- Capability fallback: without native streaming or topics, the core flow still works through ordinary status messages and commands, with the difference clearly disclosed.
BotFatherV2 relevance and limits
BotFatherV2 lets users create and modify Telegram bots through an AI conversation. You can use the requirement and test paths above to describe the intended behavior, then inspect which Telegram capabilities the generated version actually uses.
BotFatherV2 is an independent product with no affiliation to Telegram's official BotFather. Its current public AI-development documentation says that the initial release does not add paid runtime AI integrations, and its fixed SDK surface excludes arbitrary npm packages and Node/Bun APIs. This article describes public Telegram platform features; it does not assert that the current BotFatherV2 runtime supports every Bot API 10.3 method. Check the latest validation result and product documentation before generating a version.
Sources and verification date
- Telegram, Telegram Bot Features, official English documentation; no publication date displayed. Checked October 12, 2026.
- Telegram, Telegram Bot API, official English documentation; Bot API 10.3 is dated August 24, 2026. Checked October 12, 2026.
- BitBear Studio, BotFatherV2, Build with AI, English product documentation; no publication date displayed. Checked October 12, 2026.