I run a Telegram Stars payment bot for $0/month forever — on GitHub Actions, not a server
Описание и применение
Бот Telegram Stars, работающий на GitHub Actions, обеспечивает непрерывный ответ на запросы pre‑checkout за нулевую стоимость, используя 6‑часовые задания и механизм повторной отправки коммитов.
Задача
Telegram requires answerPreCheckoutQuery within 10 seconds of every payment attempt, so a bot must be always‑on to respond, normally incurring hosting costs.
Результат
Near‑continuous coverage of Telegram pre‑checkout queries for $0/month, with a robust push‑retry mechanism to prevent duplicate deliveries.
Рабочий процесс
- 1. Configure a GitHub Actions workflow with a cron schedule of every 6 hours and a concurrency group named telegram-stars-bot.
- 2. In each run, long‑poll Telegram’s getUpdates for ~5h50m to stay within the 6‑hour job limit.
- 3. Process updates, answerPreCheckoutQuery, and deliver successful_payment messages.
- 4. Commit state.json (offset) and fulfilled.json (dedup list) back to the main branch as the last step.
- 5. If the push fails, retry up to five times with a rebase to avoid losing progress.
Доказательства
Telegram requires answerPreCheckoutQuery within 10 seconds of every payment attempt — there's no auto‑approve fallback.
A single GitHub Actions job can run up to 6 hours.
If anything else pushes to main during that ~5h50m window, the push fails with a plain ! [rejected] (fetch first).
- Дата записи: 2026-10-18T01:55:58.689Z