I have implemented a php telegram-bot (https://github.com/php-telegram-bot/example-bot). I'm using the getUpdates method to recieve the messages sended to my bot. The problem is that there are too many spam users sending him fake messages and for that reason I have a long tail of new messages and it produce a big delay for process the important messages. I have seen that is not possible to block this spam users and it is not possible to recieve more than 100 new message in each call through telegram API. If i'm recieving thousands of messages per second, how can I manage them all with the least possible delay?
Asked
Active
Viewed 1,308 times
2
-
Keywords: "Rate limiting" and "throttling". Keep tabs on which users are sending the bot commands and limit them to *N* requests per unit of time (e.g. 5 per minute) – tadman Jan 22 '19 at 21:57
-
How can I limit their request? – Juan Manuel Ortiz de Zarate Feb 06 '19 at 20:57
-
Using those approaches. I can't advise on a specific strategy because there's no code here for context. – tadman Feb 06 '19 at 21:29
1 Answers
0
Finally I could resolve the issue. The spam come from different groups wich my bot was added. I configure it to not permit to be added to groups and then I use the interface "leaveChat" of the bot api to leave the chats. I have recorded all the chats where my bot recieve message, the group chat ids were easy to identify because they have negative ids.
I also increase the frecuency to download updates up to 20 calls per minute.

Juan Manuel Ortiz de Zarate
- 125
- 1
- 10