Example for module usage
parent
02025c2695
commit
c6f63d39ef
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/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.AddButton({'action_name': 'This is a button', 'button_label': 'Press Me', 'post_uri': 'https://example.com/postme'})
|
||||||
|
|
||||||
|
# Sends to Office365
|
||||||
|
myhook.SendCard()
|
||||||
|
|
||||||
|
# Prints out the JSON Card information
|
||||||
|
#myhook.PrintJSON()
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/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()
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/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()
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/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()
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/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.AddMultichoice({'action_id': 'multichoice', 'action_name': 'This is a MultiChoice Multiselect', 'button_label': 'Submit Choices', 'input_hint': 'Select all that apply', 'choices': [{'display': 'One', 'value': 1},{'display': 'Two', 'value': 2},{'display': 'Three', 'value': 13}], 'post_uri': 'https://example.com/postme', 'multiselect': True})
|
||||||
|
myhook.AddMultichoice({'action_id': 'multichoice', 'action_name': 'This is a MultiChoice Singleselect', 'button_label': 'Submit Choice', 'input_hint': 'Select One', 'choices': [{'display': 'One', 'value': 1},{'display': 'Two', 'value': 2},{'display': 'Three', 'value': 13}], 'post_uri': 'https://example.com/postme'})
|
||||||
|
|
||||||
|
# Sends to Office365
|
||||||
|
myhook.SendCard()
|
||||||
|
|
||||||
|
# Prints out the JSON Card information
|
||||||
|
#myhook.PrintJSON()
|
||||||
Loading…
Reference in New Issue