teams-webhook/examples/message.py

30 lines
768 B
Python

#!/usr/bin/env python
import sys,os
sys.path.append('../')
import teamswebhook as twh
myhook = twh.MessageCard()
myhook.channel_uri = 'https://outlook.office.com/webhook/CHANNELUUID/IncomingWebhook/WEBHOOKUUID'
data = [
{'Router': 'crN-lllN'},
{'SomeText': 'Some other text'},
{'Preformatted': '<pre>\nsome output\n\twith an indent\n</pre>'}
]
myhook.title = 'Some title of a message'
myhook.subtitle = 'Some example subtitle'
# Select an icon from icons.json array or put a URL/Base64 string, can also be sent wihtout
#myhook.icon = twh.stock_icons['cute']['firewall']
#myhook.icon = twh.stock_icons['gradient']['system_task']
myhook.AddFacts(data)
# Sends to Office365
myhook.SendCard()
# Prints out the JSON Card information
#myhook.PrintJSON()