Why does my Telegram bot stop responding after several days of inactivity

Bot stops working after period of silence

I’m facing a weird issue with my Telegram bot. Here’s what happens:

  1. User sends /start command
  2. Bot begins sending automated messages correctly
  3. After a few days of no user interaction, the bot stops sending messages completely
  4. Once the user sends any message, the bot starts working again

I’m using this API endpoint to send messages:

https://api.telegram.org/bot{MY_TOKEN}/sendMessage?chat_id={USER_ID}&text={MESSAGE_CONTENT}&disable_web_page_preview=true

Is there some kind of timeout or limit that causes this behavior? Where can I find documentation about how long bots stay active without user interaction? Has anyone experienced similar problems with their bots going silent after inactivity?

yea, hosting can def be a reason. free apps like heroku go to sleep if not used for a bit. try a ping tool to keep it active. also, check their docs for specific timeout times.

This sounds like a webhook issue, not Telegram’s limits. Your connection’s probably dropping after sitting idle too long. Telegram doesn’t timeout bot messaging - bots can send automated messages forever unless users block them. Since it works again after user interaction, your server or webhook handler is likely going idle. Check your server logs during those quiet periods for connection errors or missing heartbeats from Telegram. You might need a keep-alive mechanism or just switch to long polling if this keeps happening.

Had the same issue last year. Turns out my VPS provider was killing idle processes - the bot wasn’t timing out on Telegram’s end, just getting shut down by the host when it detected no CPU activity. I fixed it with a simple cron job that makes a lightweight API call every few hours to keep things active. Try logging your bot’s status during those quiet periods to see if the process is still running. Pretty common on shared hosting since providers want to manage resource usage.