Send Github pull request notifications to Slack.
- Each time a PR is created in your organization it will send a message to a specific Slack channel with a link to the PR and its technology emoji assigned.
- When the PR is merged it will add a merged reaction emoji.
- You can add
\slack `This is a small pr @slack_user`at the end of the PR's description to add a message to the notification and to notify specific Slack users.
Make sure to use ` ` in the message in case the Slack user name is the same as someone's GitHub name, so the github user is not notified.

- It will not send a notification if the PR is a draft.
- It will remove the notification if the PR has an
ON HOLDlabel and resend the notification when the label is removed.
- Clone this repo
- Install PostgreSQL in case you don't have it
- Create your
database.ymlandapplication.ymlfiles. There are sample files in/config bundle install- Generate a secret key with
rake secretand paste this value into theapplication.yml. - Fill the
SLACK_API_TOKENandSLACK_BOT_TOKENinapplication.yml. To get the credentials: log in to https://api.slack.com/apps, select your application and then click OAuth Tokens & Redirect URLs.SLACK_API_TOKENis theOAuth Access TokenandSLACK_BOT_TOKENisBot User OAuth Access Token rails db:createrails db:migraterails db:seed# this will create an admin with admin@example.com:passwordnpm install -g ngrokInstall Ngrokrspecand make sure all tests passrails s- You are ready!
- Create a dummy repository in github with a couple branches.
- Run server:
rails s -p 3001 - In another terminal run ngrok:
ngrok http 3001 - Copy ngrok url to github configuration page (settings->webhooks)
http://xxxxxxx.ngrok.io/api/v1/notifications_filter - Change CHANNEL in SlackNotificationService to your
@nameor#some_test_channel - Create/edit pull request adding or removing labels. This will execute the webhook.
You can access the admin page at http://localhost:3001/admin/users and add users that you want to ignore
Install heroku cli https://devcenter.heroku.com/articles/heroku-cli#download-and-install
- Setup:
heroku login
enter credentials
heroku git:remote -a rootstrap-pull-request-to-slack
- Push:
git push heroku master
Public URLs for exposing your local web server https://ngrok.com/
Info about github hooks and Pull request payload
https://developer.github.com/webhooks/configuring/ https://developer.github.com/v3/activity/events/types/#pullrequestevent
Bug reports (please use Issues) and pull requests are welcome on GitHub at https://github.com/rootstrap/pull_requests_to_slack/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The library is available as open source under the terms of the MIT License.
Github for Slack is maintained by Rootstrap with the help of our contributors.


