This API will be a single point of entry for events coming from slack.
To run and make changes to this service locally:
- Run a rabbitmq container with ports 5672 and 15672 published.
docker run -d --name=rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:management-alpine
- Make a .env file if you don't have one. Copy/paste the .env.example contents into this file, but change
RABBBITMQ_HOST
tolocalhost
instead ofrabbitmq
. (This is so your local app can connect to your rabbitmq container.) - Run the app in watch mode so any changes your make will cause the app to be rebuilt and restarted.
npm run watch
- Navigate to the project directory.
- Create a
.env
file based on the.env.example
file. - Bring up the system:
docker-compose up -d
- Navigate to the project directory
- Create a
.env
file based on the.env.example
file - Build the container:
docker build -t decentstudio/decent-slack-receiver:latest .
- Run the container:
docker run --name=decent-slack-receiver -d -p 8080:80 --env-file=.env decentstudio/decent-slack-receiver:latest
To use the receiver with slack:
- Create a new app in slack (or use an existing one).
- Add a bot in the Add Features section of the Basic Information page.
- Copy the Client ID, Client Secret, and Verification Token values into your .env file.
- If in development, with the app running on port 80 (
npm run watch
), use ngrok to create an https public endpoint.ngrok http 80
(Run this in a separate terminal from your app.) - Copy the https endpoint from the terminal in which ngrok is running. Go to OAuth & Permissions, click "Add a new Redirect URL", and enter the ngrok https endpoint followed by
/api/slack/authorize
- Go to Manage Distribution and click the Add to Slack button.
- Click Authorize on that page, and the receiver will receive the bot access token for the team and start listening for messages in whatever channel the bot is added to.
- When messages are sent in the slack team you installed it on, the messages should appear in your console where your app is running. If you
ran docker-compose, you will need to view the logs of the slack receiver container.
docker logs -f <container name or ID>