Answer the question
In order to leave comments, you need to log in
How to make a mailing to users of a telegram bot in python?
I'm trying to make the first bots in Telegram in Python. I use the telebot library (pyTelegramBotAPI).
I need to send a message to all users who have started the bot.
I understand, we save their id somewhere. Then, for example, we loop through them and send a message to each like this:
for user_id in users:
bot.send_message(user_id, 'message')
Answer the question
In order to leave comments, you need to log in
You can simply run another script that will create a telebot object with the same token, but will not use polling, but will immediately call send_message as many times as necessary. But we must not forget about the rate limit.
PS: Why do they ask here every week about mailing list bots? Are there really no more interesting learning tasks?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question