diff --git a/README.md b/README.md index 48e1564..85b9370 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,7 @@ git clone https://github.com/esanchezm/amazon-cloudwatch-to-slack.git cd amazon-cloudwatch-to-slack heroku apps:create -heroku config:set SLACK_COMPANY_NAME=yourcompany \ - SLACK_TOKEN=12345 \ +heroku config:set 'SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX' git push heroku master ``` @@ -32,7 +31,7 @@ You can optionally set a diferent slack channel, username or avatar to customize ``` heroku config:set SLACK_CHANNEL=#yourchannel\ SLACK_USERNAME="AWS CloudWatch" \ - SLACK_ICON_URL="http://www.example.com/bot_avatar.png" + SLACK_ICON_URL="http://www.example.com/bot_avatar.png" \ SLACK_ICON_EMOJI=":ghost:" ``` @@ -43,10 +42,10 @@ Additional configuration parameters for SES notifications: ``` heroku config:set SLACK_SES_CHANNEL=#otherchannel\ SLACK_SES_USERNAME="AWS SES" \ - SLACK_SES_ICON_URL="http://www.example.com/bot_avatar.png" + SLACK_SES_ICON_URL="http://www.example.com/bot_avatar.png" \ + SLACK_SES_ICON_EMOJI=":ghost:" ``` - Or just push the button: [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) diff --git a/routes/index.js b/routes/index.js index d72a8f6..d4f805b 100644 --- a/routes/index.js +++ b/routes/index.js @@ -203,11 +203,16 @@ exports.index = function(req, res) { payload = process_ses_delivery_notification(json_message); } - var slackUrl = - 'https://' + - process.env.SLACK_COMPANY_NAME + - '.slack.com/services/hooks/incoming-webhook?token=' + - process.env.SLACK_TOKEN; + var slackUrl; + if (typeof process.env.SLACK_WEBHOOK_URL != "undefined") { + slackUrl = process.env.SLACK_WEBHOOK_URL; + } else { + slackUrl = + 'https://' + + process.env.SLACK_COMPANY_NAME + + '.slack.com/services/hooks/incoming-webhook?token=' + + process.env.SLACK_TOKEN; + } if (typeof process.env.SLACK_USERNAME != "undefined") { payload["username"] = process.env.SLACK_USERNAME;