I would like to use alarm notification. Could you share script for me,please?
I’m not sure you can send notifications to teams directly from the alarm/pipeline configuration…
But you can send a notification email or text message, and then I’m sure there are ways of forwarding those to a teams channel.
Thank you very much.
I didnt completely test this out, but this should roughly get you on the right path.
EDIT: Replaced this with a version that I just tested and posted to a teams chat!
def msTeams(val):
import system
url = "https://outlook.office.com/webhook/" \
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx@xxxxxx-xxx-xxx-xxx-xxxxx/" \
"IncomingWebhook/xxxxxxxxxxxxxxxx/" \
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
contentType = "application/json"
brutData = {
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Ignition Notification Message",
"sections": [{
"activityTitle": "Ignition Notification Message",
"activitySubtitle": "Ignition Web Service",
"activityImage": "https://avatars0.githubusercontent.com/u/26392698?s=400&v=4",
"facts": [{
"name": "Message",
"value": val},
{"name": "Date",
"value": system.date.now()
},
]
}]
}
postData = system.util.jsonEncode(brutData)
result = system.net.httpPost(url, contentType, postData)
return result
Apologies if I’m being obtuse, but where does one find the values that fill in the three XXX strings?
url = “https://outlook.office.com/webhook/”
“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx@xxxxxx-xxx-xxx-xxx-xxxxx/”
“IncomingWebhook/xxxxxxxxxxxxxxxx/”
“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx”
Thanks!
To get those values you need to create a web hook on the teams channel
This document explains how, I can’t do it in my teams org to show you, but this is fairly comprehensive