How to broadcast message to your telegram bot with list of chat id



import requests as requests
url = "https://api.telegram.org/bot<token>/"  # don't forget to change the token!
def send_message(chat, text):
    params = {'chat_id': chat, 'text': text}
    response = requests.post(url + 'sendMessage', data=params)
    return response


def main():
    ch_id = ['chat_id', 'chat_id', 'chat_id', 'chat_id', 'chat_id']
    for c_id in ch_id:
        send_message(c_id, "Hello everyone")


main()


Post a Comment

Previous Post Next Post