-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
31 lines (22 loc) · 826 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pymsteams
def sendtoteams(request):
# Get the JSON from Request
data = request.get_json()
#Get Message Value (Depends on the form_param you define), user dashboard link
title = data['form_params']['Title']
message = data['form_params']['Message']
msteamswebhook = data['data']['msteamswebhook']
user_dash = data['data']['link']
link_text = data['data']['linktext']
# You must create the connectorcard object with the Microsoft Webhook URL
myTeamsMessage = pymsteams.connectorcard(msteamswebhook)
# Add title to the message.
myTeamsMessage.title(title)
# Add text to the message.
myTeamsMessage.text(message)
# Add Link Button
myTeamsMessage.addLinkButton(link_text, user_dash)
# send the message.
myTeamsMessage.send()
#if False not in response:
return '{"looker": {"success": true}}'