Posts

Showing posts with the label TelegramBot

Sending message to Telegram Group, User or Bot using Python

In Programming world, most of the time while automating a system/tasks you need to send completion or timely notification about the status. Now a days the easiest way of notification is WhatsApp or Telegram as our SMS and email boxes are mostly flooded with spams. In this article we will try to explain about telegram automation using simple Python script. Install json and telegram package using pip package manager: pip install json pip install python-telegram-bot read token of your telegram bot and chat_id from json file telegram_credentials.json call notify_(message) function from the point in your script where you need to send notification and pass token and chat_id to it. import json import telegram def notify_(message): t_bot = telegram.Bot(token=token) t_bot.sendMessage(chat_id=chat_id, text=message) with open('./telegram_credentials.json', 'r') as keys_file: k = json.load(keys_file) token = k['telegram_token'] chat_id