I was wondering if I could send a message with my bot on telegram bot api, to multiple chat_id, but I cant figure it out. that’s totally because of telegram apis are so hard to understand.
I have used this for send a message to one chat_id:
https://api.telegram.org/botTOKKEN/sendMessage?chat_id=xxxxxxx&text=Hi+John
4
Answers
There is no way to make bot to sendMessage to multiple chat id but there is a trick that can fix it for now 🙂
Why not sending each chat id a message ?!
Let’s look at this example in PHP :
Just for your information.
We could input the chat_ids to database. Query and loop the message section for sending the message to multiple chat-id with sleep().
I am not a programmer. So I could not make an example.
The problem with foreach or any other massive sendMessage is that the API will not allow more than ~30 messages to different users per second.
According to Bots FAQ in telegram site:
and solution in Bots FAQ page:
In addition to @farsad ‘s answer: Add sleep(NUMBER_OF_SECONDS); inside the foreach loop to not get banned by telegram. As there is a limit of 30 messages per second for bots in Telegram API