Add telegram backend for sending messages.

This commit is contained in:
Ceda EI 2019-05-17 20:39:03 +05:30
parent c5be1882f8
commit 6cebd436b8
2 changed files with 11 additions and 0 deletions

0
backends/__init__.py Normal file
View File

11
backends/telegram.py Normal file
View File

@ -0,0 +1,11 @@
import requests
def send(tg_config, message):
url = "https://api.telegram.org/bot{}/sendMessage".format(
tg_config["bot_token"])
data = {
"chat_id": tg_config["user_id"],
"text": message
}
requests.post(url, data=data)