Post2Slack posts to a Slack channel as the authorized user.
For your .env file:
- Set a
PORT
. - Set
SLACK_CLIENT_ID
to your Slack client ID. - Set
SLACK_CLIENT_SECRET
to your Slack client secret. - Set
POST_SIGNING_SECRET
to a base64-encoded 32-byte value After compiling this app (which is possible without the secrets), usemix post2_slack.gen.secret
. - Set
STATE_SIGNING_SECRET
to another base64-encoded 32-byte value. - Set
SLACK_REDIRECT_URI
to your redirect URI. You can use ngrok for development. It should look something likehttps://my-host/oauth/slack/callback
.
To start:
foreman start
This can easily be deployed to Heroku via docker. First, set the above env vars, as well as MIX_ENV=prod
, and excepting PORT
.
heroku apps:create
heroku container:login
heroku container:push web
heroku container:release web
Post2Slack uses Slack OAuth to get a token with chat:write:user
scope, which is returned inside of an expiring, encrypted JWE token (this means that the token is not readable, and despite the fact that typical Slack access tokens don't expire, it expires in 1 week). Then, a normal Slack API chat.postMessage
request can be sent to Post2Slack, along with a Authorization: Bearer $token
header for authentication.