Marketplace · Supplier tools
A Telegram bot that deploys itself and rolls back on its own
Suppliers use a Telegram bot to publish products to their channels, and they pay for it. A broken release means broken posts for paying customers, so the bot checks itself after every deploy and undoes the release if something is wrong.
The situation
A marketplace offers its suppliers a Telegram bot. Suppliers use it to publish their products to their own Telegram channels. When a price or stock level changes, the posts update themselves.
The bot runs on a subscription with a free trial. That makes it a product, not a side script: if a release breaks it, paying suppliers see wrong prices or no posts at all.
What we did
The bot is written in Python with aiogram. We set up its delivery so that a bad release cannot stay live.
- Deploy on merge. When a change is merged, the bot deploys itself. Nobody copies files to a server.
- Health check after deploy. For 25 seconds after starting, the new version has to show it is healthy.
- Automatic rollback. If it does not come up healthy in that window, the bot returns to the previous version on its own.
The checks and the rollback run with the deploy itself, so they apply to every release, not only the ones someone remembered to watch.
Outcome
Changes reach suppliers as soon as they are merged. A release that does not come up healthy is undone automatically after its 25-second check. The developer finds out from the failed deploy, not from a customer complaint.
This is the same principle we apply to websites and shops: every deploy can be undone, and the system does it without waiting for a human.