Created
July 14, 2017 19:22
-
-
Save anonymous/1235c08699a156f6c5a36492f7be0bbb to your computer and use it in GitHub Desktop.
BT360 Custom notification Teams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Send to Teams | |
| var httpWebRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("USE THE WEBHOOK CONNECTOR HERE"); | |
| httpWebRequest.ContentType = "application/json"; | |
| httpWebRequest.Method = "POST"; | |
| using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) | |
| { | |
| string json = "{ \"@type\": \"MessageCard\", \"@context\": \"http://schema.org/extensions\", \"summary\": \"This is the summary property\", \"themeColor\": \"0075FF\", \"title\":\""+ alarm.Name + "\", \"text\":\"An Error occured\"}"; | |
| streamWriter.Write(json); | |
| streamWriter.Flush(); | |
| streamWriter.Close(); | |
| } | |
| var httpResponse = (System.Net.HttpWebResponse)httpWebRequest.GetResponse(); | |
| using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) | |
| { | |
| var result = streamReader.ReadToEnd(); | |
| } | |
| LoggingHelper.Info("Teams notification completed successfully"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment