-
Notifications
You must be signed in to change notification settings - Fork 0
/
teams_card.py
56 lines (52 loc) · 1.39 KB
/
teams_card.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
This Python file is a example for sending a "Message Card"
into a Microsoft Teams Channel.
For more information refer to: https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
"""
import requests
import json
url = "https://YOUR-TENANT.webhook.office.com/webhookb2/" \
"id "
payload = json.dumps({
"@type": "MessageCard",
"themeColor": "0072C6",
"@context": "https://schema.org/extensions",
"title": "Test einer Messagecard",
"text": "Click **Learn More** to learn more about Actionable Messages!",
"potentialAction": [
{
"@type": "ActionCard",
"name": "Send Feedback",
"inputs": [
{
"@type": "TextInput",
"id": "feedback",
"isMultiline": True,
"title": "Let us know what you think about Actionable Messages"
}
],
"actions": [
{
"@type": "HttpPOST",
"name": "Messagecard validieren",
"isPrimary": True,
"target": "https://messagecardplayground.azurewebsites.net/"
}
]
},
{
"@type": "OpenUri",
"name": "Learn More",
"targets": [
{
"os": "default",
"uri": "https://docs.microsoft.com/outlook/actionable-messages"
}
]
}
]
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)