teams-webhook/examples/input.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.AddTextInput({'action_id': 'singleline', 'action_name': 'This is a TextInput Singleline', 'button_label': 'Single Text Input', 'input_hint': 'This is text that shows in the background of the input', 'post_uri': 'https://example.com/postme', 'multiline': False})
myhook.AddTextInput({'action_id': 'multiline', 'action_name': 'This is a TextInput MultiLine', 'button_label': 'Multi Text Input', 'input_hint': 'This is text that shows in the background of the input', 'post_uri': 'https://example.com/postme', 'multiline': True})
# Sends to Office365
myhook.SendCard()
# Prints out the JSON Card information
#myhook.PrintJSON()