Slack Cutter cuts you some slack!
Slack Cutter is an intermediary API to communicate with Slack. You can create custom Slack slash commands, incoming hooks, bots, cron jobs (soon)...
Written in ES6/2015 with transpiling to ES5 via Babel
Right now we have the following slash commands:
- Extension Number: Lookup your colleague's extension number. Eg:
/ext John
: searches for John's extension number/ext
: List all available extension numbers
- Continuous Integration server: Trigger builds in your CI server. Eg:
/ci build my-product
/ci release my-product 1.2.3-alpha
/ci deploy my-product 1.2.3-alpha
- Pull Requests: List a project Pull Requests from GitHub in a particular channel to facilitate code review and prioritization. Eg:
/prs my-product
- Any new API should be fairly easy to add. Just create a new route.
The configuration variables are set via environment variables and/or using the .env
file (environment variable has precedence over .env
file).
Just copy the example.env
as .env
and modify it as needed.
The GitHub credentials are only needed if you're planning to use the /prs
commands.
Important: if you're going to use a .env
file AND are using Docker, edit it before you build the Dockerfile.
Every slash commands takes a .json
with private data. See the README in each command's directory to learn how to configure and use them. Basically, you'll have to copy the config.example.json
to config.json
and edit them to your needs ;-)
.
You can install it in your own local infrastructure or in a cloud service like heroku. Alternatively, you can build a Docker image and deploy as container
- Set up a server address in your local infrastructure that will serve this application (eg:
slackapi.mycompany.com
orslackapi.heroku.com
) - Clone/download this repo to your chosen server
- Configure your application according to the "Configuration" section above
- Install NodeJS if you don't have it already
- Run
npm install
in the app's root folder
Important note: make sure you don't have any firewall blocking the incoming TCP port (default is PORT 5000 as defined in the "Configuration" section above)
- Build the Docker image:
npm run container:build
Note: In Linux the <dockerhost>
is localhost
, within OSX's Boot2docker, use the IP reported by the command: boot2docker ip
- Run
npm start
to fire up the application
-
Run the container: 1. If you used the
.env
file:npm run container:run
2. Without.env
file:docker run -e PORT=5000 -e SLACK_TOKEN=123123 -e SLACK_DOMAIN=company -e SLACK_CHANNEL=channel -p 5000:5000 -d slack-cutter
-
Ensure the container is running (you should also be able to access the service using web browser:
http://<dockerhost>:5000/
).
You can run npm run | grep container:
to see other available container actions.
See CONTRIBUTING.md.