Anonymous Slack web portal. Read and write messages, help-desk style. Chat on the Demo App!
Slack is convenient and easy to use, yet people don't always want to log in! Simply present them with a link to your website and slack channel via this app, and presto, they can be chatting with you in seconds!
In order for this application to work, we will need a Slack API Oauth Access token. To do this, I recommend creating a private slack app, authorizing it with special scopes, and using the returned access token.
Here are the steps:
- Visit the new app page
- Enter an app name (eg: cut-me-some-slack), select the workspace you wish to connect to, then click 'create app.'
- note the 'Client ID' (
CLIENT_ID
) and 'Client Secret' (CLIENT_SECRET
) fields. We will use these later (save for now). - On the app page, click 'add features and functionality', then 'permissions.' Add a redirect url (
CALLBACK_URL
) of the formhttp://localhost:3000/callback
then click 'Save URLs.' - In your browser (or with
curl
) make a request of the following form (substituting yourCLIENT_ID
andCALLBACK_URL
):https://slack.com/oauth/authorize?client_id=CLIENT_ID&scope=client+admin&redirect_uri=CALLBACK_URL
- Authorize the app. You will be redirected to the callback of the form
http://localhost:3000/callback?code=CODE&state=
Save the value ofCODE
for the next step. - Using your
CODE
,CALLBACK_URL
,CLIENT_ID
, andCLIENT_SECRET
, make aPOST
request to complete the Oauth flow and install the client in your workspace:curl -XPOST 'https://slack.com/api/oauth.access?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=CODE&redirect_uri=CALLBACK_URL'
This should output a piece of JSON in the form:
{"ok":true,"access_token":"xoxp-...","scope":"read,client,admin,identify,post","team_name":"cutmesomeslack-demo", ...}
Save the access_token
value - this is your SLACK_TOKEN
to be used further down for configuration.
$ heroku create my-slack-app
$ heroku config:set SLACK_TOKEN=xoxp-... # slack token with correct scopes, as created above
$ heroku config:set HEROKU_APP_DOMAIN=my-slack-app.herokuapp.com # domain for websockets
$ heroku config:set REACT_APP_SLACK_CHANNEL=general # default channel to display
$ heroku config:set JWT_SECRET=$(uuidgen) # for user identity auth
$ heroku buildpacks:set heroku/go
$ heroku buildpacks:add heroku/nodejs
$ git push heroku master # deploy
Pull requests welcome!
To start the React development server:
$ yarn install
$ # Optionally, export REACT_APP_SLACK_CHANNEL=api-testing
$ # Optionally, export REACT_APP_BACKEND_URI=ws://otherhost:otherport/stream
$ PORT=3001 yarn start
For development of the backend, a .env
file is supported with KEY=VALUE
pairs.
To start the Golang backend:
$ PORT=3000 go run cmd/cut-me-some-slack/main.go
Then visit http://localhost:3001 for the development, hot-reloading,
React frontend or http://localhost:3000 for the production build (once
yarn build
has been run).
- auth0 support
- channel config (disallow, allow)
- more channel info (users, typing, etc)
- message update / delete visualization
- reactions
- better edit pane (autocomplete, @mentions, #mentions)
- threads
- bot message ui
- attachment viewing
- direct messages
- ...