We have a Telegram bot. It has around 1.2 million subscribers.
Now we’re facing a problem in sending messages to these number of subscribers.
Telegram bot API does not provide any batch message functionality and we’d have to send individual requests to Telegram. The problem is, after a few thousand messages, Telegram starts responding with Error 429: too many requests, and does not accept any requests for a while.
How can we effectively message our subscribers?
5
Answers
I’m the owner of Ramona Bot.
There is a limit for sending message to users. as they said ~30 message per second. Otherwise you will get that Error 429.
You should simply implement a global rate limiter to ensure no single user gets above a fixed number of messages per second. to be safe, set your limiter at lower than 30, maybe even to 5 msgs per second.
Really anything higher than 5 messages per second to a single user quickly becomes an annoyance.
cheers.
Based on the Telegram Bots FAQ for sending messages, you should consider this:
I had similar problems with messages, the pause between which was 0.5 seconds (this is much less than 30 messages per second!). The problem was only associated with messages, the content of which I tried to change. So when you try to use "edit_message_text" or "edit_message_media" take more pause between messages.
It can happen also if a Telegram group is in the slow mode and the bot tries to send more that one message at once to that group. I fixed this by adding a delay to the bot trigger mechanism.