Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ServiceNow - Meraki Webhook Alerts
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// Parse Meraki Alerts Webhook Data
var requestBody = request.body;
var requestString = requestBody.dataString;
var requestParsed = {};
requestParsed = JSON.parse(requestString);
var merakiAlert = requestParsed;
// Create SNOW Incident
var gr = new GlideRecord('incident');
gr.initialize();
gr.description = JSON.stringify(merakiAlert);
gr.company = merakiAlert['networkName'] + merakiAlert['networkId'];
gr.short_description = merakiAlert['alertType'];
gr.priority = 4; // default "low"
// Customize Incidents based on Alert
// Settings Changed
if (merakiAlert['alertType'].includes("Settings changed")) {
gr.priority = 4;
}
// VPN Connectivity
if (merakiAlert['alertType'] == "VPN connectivity changed") {
if (merakiAlert['alertData']['connectivity'] === "false") {
gr.priority = 1;
gr.impact = 1;
gr.short_description = gr.short_description + "connectivity: DOWN";
} else {
gr.priority = 4;
gr.impact = 4;
gr.short_description = gr.short_description + "connectivity: UP";
}
}
gr.insert();
return;
})(request, response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment