Skip to content

Instantly share code, notes, and snippets.

Created July 13, 2017 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2b7f21cd0cce16f642c3a389ceee689b to your computer and use it in GitHub Desktop.
Save anonymous/2b7f21cd0cce16f642c3a389ceee689b to your computer and use it in GitHub Desktop.
Azure BT360-Teams Fuction
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
if (req.body) {
var artifacts = [];
req.body.forEach(function(item){
if(item.monitorGroupStatus == 'Critical')
{
item.monitors.forEach(function(app){
if(app.monitorStatus == 'Critical')
{
artifacts.push("**" + app.monitorGroupName + "**");
artifacts.push(app.monitorName);
artifacts.push("Error. \n\n");
}
})
}
});
context.res = {
// status: 200, /* Defaults to 200 */
body: artifacts.join(" ")
};
}
else {
context.res = {
status: 400,
body: "Please pass a name on the query string or in the request body"
};
}
context.done();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment