Full Version: Simplest way to send Telegram message by script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is the simplest way to send some notifications on smartphone by python script. No install extra module is needed.

First find and add BotFather on Telegram and send /newbot message. Follow instructions. Save new token from BotFather. 
[Image: ea9561af_tn.png]


Next, find and add IDBot and send /getid message. 
[Image: 03e0570c_tn.png]

import  urllib.request

token = '_PUT_YOUR_TOKEN_HERE_'
chatID = '_PUT_YOUR_CHATID_HERE_'

message = 'Diviera.com - place where PRO get heart attack'.replace(' ','%20')
urlMessage = 'https://api.telegram.org/bot' + token + '/sendMessage?chat_id=' + chatID + '&text=' + message

sendIt = urllib.request.urlopen(urlMessage)

print(sendIt.read())