Azure BT360-Teams Fuction
This file contains 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
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