0
votes

I have a bot which takes some simple information similar to filling a form. It works fine for 2 to 5 users but it suddenly stops receiving and sending messages when number of users reach upto 20. There is no error in logs. It just stops. I want to ask is there any limit to number of messages per second Telegram bot can respond to? Can this be Telegram bot issue or should I debug my code starting from 1 user and gradually increase number of users to see if something appears. Please guide.

Thanks

1
I found the same information as in Mohammad Hamedani's answer after 30 seconds of Googling. It would have been quicker for you to do that than to post your question! - DaveyDaveDave

1 Answers

3
votes

Based on telegram documentation, if telegram limits occured, telegram return 429 response code.

Telegram limits are:

  • one message per second in one chat
  • to 30 messages per second for multiple chats

You can use sleep() or usleep() function to prevent telegram limitation.

sleep(1); //sleep script for one second
usleep(500000); //sleep script for half-second - 0.5*1000000