Skip to content

Instantly share code, notes, and snippets.

@burik666
Last active March 13, 2021 02:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burik666/b8b720c36a6c88a95eb0fc681bfcad05 to your computer and use it in GitHub Desktop.
Save burik666/b8b720c36a6c88a95eb0fc681bfcad05 to your computer and use it in GitHub Desktop.
Simple python script for sending messages to telegram. (I use for zabbix)
#!/usr/bin/env python
import requests
import sys
token = 'YOUR_BOT_TOKEN_HERE'
msg = {
'chat_id': sys.argv[1],
'text': sys.argv[2],
"disable_web_page_preview":True,
"parse_mode":"HTML"
}
requests.post("https://api.telegram.org/bot%s/sendMessage" % token, json=msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment