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()