I run a Telegram Stars payment bot for $0/month forever — on GitHub Actions, not a server
Description and use
A Telegram Stars bot running on GitHub Actions delivers continuous pre‑checkout responses at zero cost, using 6‑hour jobs and a push‑retry strategy.
Problem
Telegram requires answerPreCheckoutQuery within 10 seconds of every payment attempt, so a bot must be always‑on to respond, normally incurring hosting costs.
Outcome
Near‑continuous coverage of Telegram pre‑checkout queries for $0/month, with a robust push‑retry mechanism to prevent duplicate deliveries.
Workflow
- 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.
Evidence
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).
- Record date: 2026-10-18T01:55:58.689Z