Created
January 21, 2014 21:43
-
-
Save anaptfox/8548997 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//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