Why Free Web Hosts Put Telegram Bots to Sleep (And How to Avoid It)
Standard web hosts expect incoming HTTP traffic and freeze idle containers. Here is why long-polling Telegram bots fail there and how persistent bot hosting works.
On This Page
The 15-Minute Idle Timeout Problem
Many general-purpose cloud hosts offer free web service tiers designed for HTTP websites. When no browser hits the public URL for 15 minutes, the platform suspends the container to reclaim memory.
A Python Telegram bot using getUpdates long polling initiates outbound HTTPS connections to api.telegram.org and receives zero inbound HTTP requests. The web host assumes the app is idle and kills the worker, leaving your Telegram users staring at unanswered commands.
Long Polling vs. Webhooks on Managed Bot Infrastructure
You can avoid sleep cycles in two ways: configure a TLS webhook endpoint on an always-on host, or deploy onto bot-native infrastructure that keeps workers active without requiring synthetic ping hacks.
- Avoid third-party cron ping workarounds — they violate many free PaaS terms and still drop messages during cold starts.
- Verify whether outbound HTTPS to api.telegram.org is unrestricted before choosing any host.
- Start with gravixHOST using 30 free trial Coins (40 with a referral code) and zero credit card setup.
What Actually Happens to Telegram Users During a Cold Start
When a free web host puts your container to sleep and a user taps /start inside Telegram, nothing wakes the container because Telegram does not send an HTTP request to your sleeping web URL when you use long polling. Even with webhooks, a 40-to-60 second cold start causes Telegram servers to retry and back off, delaying replies or dropping callback queries entirely.
Moving your bot onto persistent cloud hosting built specifically for Python Telegram workers removes both the 15-minute idle kill timer and cold-start latency spikes.
- Idle Behavior
- Container freezes after 15 min
- First Reply Latency After 1 Hour Idle
- Bot stays offline until manual restart
- Idle Behavior
- Container sleeps; wakes on POST
- First Reply Latency After 1 Hour Idle
- 30–60 seconds cold start (callback timeout risk)
- Idle Behavior
- Always-on bot container
- First Reply Latency After 1 Hour Idle
- Under 100ms immediate response 24/7
Key Takeaways
- General web PaaS free tiers freeze long-polling bots because polling creates no inbound HTTP hits.
- Bot-native hosting keeps handlers reachable without cold-start delays or fragile keep-alive pings.
Host your Telegram bot 24/7 with gravixHOST
Deploy Python scripts straight from your Android phone with live BotFather probes, snapshot backups, and 30 free trial Coins.
Helpful Tools & Next Steps
