Skip to content

Instantly share code, notes, and snippets.

@dgershman
Last active March 15, 2016 14:37
Show Gist options
  • Save dgershman/adf6d68ff1f6cfa2c14c to your computer and use it in GitHub Desktop.
Save dgershman/adf6d68ff1f6cfa2c14c to your computer and use it in GitHub Desktop.
module['exports'] = function sendToSlack (hook) {
console.log('received payload from docker: ' + JSON.stringify(hook.req.body));
var dockerInboundPayload = hook.req.body;
var requestOptions = {
url: hook.env.SLACK_WEBHOOK_URL,
body: {
text : 'Image pushed to repo ' + dockerInboundPayload.repository.repo_name,
channel: hook.env.SLACK_CHANNEL_NAME
},
method: 'POST'
}
var request = require('request');
request(requestOptions, function(err, res, body){
if (err) {
return hook.res.end(err.messsage);
}
hook.res.end(body);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment