Last active
March 15, 2016 14:37
-
-
Save dgershman/adf6d68ff1f6cfa2c14c to your computer and use it in GitHub Desktop.
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 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