A Telegram Approval Queue Needs More Than a Send Button
Описание и применение
В статье описывается рабочий процесс Telegram‑бота, который отделяет черновики, утверждения операторов и фактическую доставку сообщений, используя отдельные JSON‑файлы для каждой стадии. Это обеспечивает точный учёт статусов и надёжность при перезапуске воркеров.
Задача
Ensuring that a Telegram operator workflow correctly distinguishes between drafted replies, human approval, and actual delivery, avoiding reporting defects and maintaining durable state across worker restarts.
Результат
The workflow now accurately tracks the lifecycle of a message from draft to approval to delivery, with clear separation of responsibilities and durable state that survives worker restarts.
Рабочий процесс
- 1. Drafts are created and stored in a drafts feed.
- 2. Operator reviews a draft and can approve or request revision via Telegram buttons.
- 3. On approval, the bot assigns a new draft identifier and moves the record to the outbox feed.
- 4. The outbox record is queued for delivery; delivery component may be unavailable at this point.
- 5. Delivery outcomes are recorded in an events feed once confirmed.
- 6. If a revision is requested, a new draft is created and the old card is closed; operators see pending revisions.
- 7. The bot verifies callback actions against server-side state to prevent approving outdated drafts.
- 8. Delivery uncertainty is handled by recording explicit states and reconciling with destination history before retrying.
Доказательства
I use a Telegram operator workflow to review drafted replies before anything can reach a recipient.
The operator approved the replacements, and the approved records reached the outbox. The delivery component was unavailable at that checkpoint.
The recorded workflow uses newline-delimited JSON files between components.
The bot's callback handler rejected actions on drafts whose stored status was no longer “shown.”
For a production sender, I would use a stable delivery reference, exclusive claiming, and durable result recording.
- Дата записи: 2026-10-24T19:26:19.083Z