teams-webhook/examples/dateinput.py

33 lines
1.2 KiB
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
#myhook.icon = twh.stock_icons['cute']['firewall']
#myhook.icon = twh.stock_icons['gradient']['system_task']
myhook.AddFacts(data)
myhook.AddDateInput({'action_id': 'dateaction', 'action_name': 'This is a DateInput', 'button_label': 'Submit Date', 'input_hint': 'This is text that shows above the input', 'post_uri': 'https://example.com/postme', 'includetime': False})
myhook.AddDateInput({'action_id': 'timeaction', 'action_name': 'This is a DateInput with Time', 'button_label': 'Submit Date/Time', 'input_hint': 'This is text that shows above the input', 'post_uri': 'https://example.com/postme', 'includetime': True})
# Sends to Office365
myhook.SendCard()
# Prints out the JSON Card information
#myhook.PrintJSON()