I’m having an issue with my Telegram bot where it behaves strangely after periods of inactivity.
When users first trigger the /start command, my bot works perfectly and sends messages as expected. However, after several days of no user interaction, the bot completely stops responding to commands. The weird part is that once a user sends any message to the bot, it suddenly starts working again.
I’m wondering if there’s any official documentation about this behavior? Is there a timeout period that causes bots to go dormant? Maybe there’s something in my configuration that’s causing this issue.
Has anyone experienced similar problems with their bots? I’d really appreciate any insights.
For context, I’m using this API endpoint to send messages:
This happens all the time - it’s usually webhook timeouts, not Telegram’s API. When your bot sits idle for hours, hosting providers or server configs can drop connections or hit resource limits that mess up webhook handling. I’ve seen this with tons of bots I’ve deployed. The bot looks dead but Telegram hasn’t actually suspended it. Quick fix: check if your webhook URL is still registered by calling getWebhookInfo during the downtime. Also add proper error handling and logging to catch failed deliveries. If you’re using polling, switch to webhooks - they’re way more reliable for production.
yeah, this isn’t telegram’s fault - they don’t have any “dormant” mode. your server or hosting is probably going to sleep or dropping connections. add some keepalive requests or health checks to fix this. also make sure you’re handling webhook failures right - sometimes it’s just silent errors stacking up.
This sounds like a hosting issue, not the Telegram API. I had the same problem - my bot would stop responding after sitting idle because I was using a free hosting plan. Free services like Heroku or Glitch put your bot to sleep when there’s no activity, so it won’t work until someone sends a message. Check your server logs during the downtime - you’ll probably see that Telegram’s webhooks aren’t getting processed. Either upgrade to a paid plan or set up a ping mechanism to keep your bot awake.