Skip to content

Instantly share code, notes, and snippets.

@anaptfox
Created January 21, 2014 21:43
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 anaptfox/8548997 to your computer and use it in GitHub Desktop.
Save anaptfox/8548997 to your computer and use it in GitHub Desktop.
//Modulus will include an object in the POST request
//https://modulus.io/codex/projects/notifications/webhooks
//Grab the type of action
var type = req.body.type;
//Grab the project details
var project = req.body.project;
var messageAction;
// Pushover has priorty settings. Learn more here: https://pushover.net/api#priority
var priority = 0;
// Grab current time
var time = moment().format("dddd, MMMM Do YYYY, h:mm:ss a");
//We want the customize the message to be different
//depending on the type of notification
switch(type){
case "start":
messageAction = " has been started.";
break;
case "stop":
messageAction = " has stopped.";
break;
case "restart":
messageAction = " has been restarted.";
break;
case "deploy":
messageAction = " has been deployed.";
break;
case "scale":
messageAction = " has scaled.";
break;
case "crash":
messageAction = " has crashed.";
priority = 2;
break;
default:
return res.send(400, "Type not found");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment