-
Notifications
You must be signed in to change notification settings - Fork 24
Slack Integration Setup
First, create a public Slack workspace for your desired hackathon.
Then, go to the Workspace settings page and click 'configure apps'.
Then click the sidebar 'Menu' tab that is located on the page. Next, in that sidebar under the account subheader, there will be an option called 'Configure Apps'.
This should take you to a new page. On this page, click the option to 'Build' in the header bar.
Then, click the 'Start Building' button.
On the next page, click the 'Create An App' button.
On the form, that appears enter an 'App Name' and select the Slack workspace created earlier.
You will now be at the Slack settings page for this application.
After that, go to 'Settings' > 'Install App'. You'll see a grayed out 'Install App to Workspace' button, scroll down.
Add the following scopes:
- chat:write:bot
- channels:history
- groups:history
- groups:read
- users:read
- users:read.email
Now, scroll up on the same page and hit the now-enabled 'Install App to Workspace.'
Hit 'Allow' on the permission request for your Slack workspace.
Back in the Slack app admin interface, go to Bot Users and create a new bot user, with the username and display name which will be visible to your participants in Slack.
Reinstall the app to your workspace if necessary.
Under OAuth and Permissions, set the "Bot User OAuth Access Token" as the "SLACKINTEGRATION_BOT_ACCESS_TOKEN" environment variable for Dashboard.
NOTE: This will begin with xoxb-
.
Under Basic Information -> App Credentials, set the "Verification Token" as the "SLACKINTEGRATION_TOKEN" environment variable for Dashboard.
Now go back to the regular Slack admin interface for your workspace, not the app you created. There, hit the Invitations tab.
Hit Invite People -> Share Invite Link.
Uncheck "send me a slackbot message" and, if a link currently exists with an expiration duration that is too short, deactivate it.
NOTE: If you used this join link anywhere else, it will no longer be valid! It is, however, important to ensure that your invite link doesn't expire before the day of the hackathon.
Hit "Get an Invite Link to Share", and select "Never Expires".
Save the generated invite link as the "SLACK_JOIN_URL" Dashboard environment variable.
If you're using Heroku with Dashboard, the Heroku environment variables should now be set like the following:
Update your app with the new configuration variables ("Restart all dynos" in Heroku).
Go to the "Event Subscriptions" tab of your Slack application (api.slack.com -> Your Apps -> choose the application name).
Enable events, and enter the URL "https://[YOUR DASHBOARD URL]/slackintegration/index". The verification should succeed; if it does not, check your server logs and Slack's error message.
Under "workspace events", add the "team_join" event and hit Save. This team_join event will be what causes Slack to notify Dashboard that a user joined your workspace, and it is how Dashboard associates a Dashboard user with a Slack user (aka the slack_id
field on user).
You should now test your integration. Because of the reliance on the "team_join" event to link a Dashboard user and a Slack user, you need to join the slack from a Dashboard user who isn't already in the slack. For example:
Create a new Dashboard user. You don't have to apply to the event, you just need that user's email address in the system. Then, while logged in to that account, go to https://[YOUR DASHBOARD URL]/join_slack
Once you've finished creating your Slack account, you should see a message from your bot. If this message was sent, then the Dashboard-Slack integration has been completed successfully!
The way the Slack integration as described above works is that Slack sends a HTTP message to Dashboard with a user's details whenever they join the workspace. Dashboard then takes the user's email and associates the Slack user ID with it in the users table. However, for currently unknown reasons, this transiently fails.
In order to resolve this, a user can press the "I already joined" button when in Dashboard prompted to join the Slack workspace before they are able to access portions of the app.
As an administrator, you can go to the "Admin > Slack Integration" section and force a reassociation of all Slack workspace users with Dashboard users. This should resolve any issues with users' Slack accounts and Dashboard accounts not being linked with each other, as long as all of your participants use the same email for their Slack account as they did on Dashboard (they are prompted to do so when joining the Slack).