Why does my Telegram bot crash when handling 20+ simultaneous users?

I created a Telegram bot that collects basic user data through a form-like interface. Everything works perfectly when I have just a few users (around 2-5 people) interacting with it at the same time.

However, I’m facing a strange problem. When approximately 20 users start using the bot simultaneously, it completely stops working. The bot doesn’t receive or send any messages anymore. The weird part is that my error logs are completely clean - no exceptions or error messages appear anywhere.

I’m wondering if this could be related to Telegram’s API rate limits. Does anyone know if there’s a restriction on how many messages a bot can process per second? Or could this be a coding issue on my end?

Should I start testing with just one user and slowly add more users to see when exactly the problem occurs? Any suggestions on how to troubleshoot this would be really helpful.

Thanks for any advice!

sounds like ur bot’s runnin out of memory or hittin connection limits, not just api throttling. add some basic logging to track memory usage and active connections during user spikes - helped me debug the same issues before.

This issue is quite common among Telegram bot developers. You may not be hitting a coding bug, but more likely hitting Telegram’s API rate limits, which is capped at 30 messages per second to distinct users. Additionally, your server might struggle with handling multiple concurrent requests if you’re relying on webhooks or polling. A common practice is to implement a message queue that can manage the outgoing messages with appropriate delays. This approach will help you avoid overwhelming the Telegram API and prevent dropped requests.

I had the exact same issue when my bot took off. Silent failures with no error logs? That’s webhook timeouts 100%. Here’s what happens: Telegram sends updates to your bot and expects a quick response. If your server gets slammed with requests and takes too long to respond back, Telegram thinks your bot died and just stops sending updates completely. That’s why everything goes quiet instead of throwing errors. Check if your webhook endpoint responds fast enough when things get busy. Quick fix: send Telegram a 200 response immediately when you get the update, then do your actual processing in the background. Saved my bot from those silent deaths.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.