Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BT360 Custom notification Teams
// 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
You can’t perform that action at this time.