This project aims to speed up the time to understand & implement multiple OAuth redirects using Slack's Bolt framework.
Screenshare.-.2022-03-20.7_00_55.PM.mp4
This demo assumes you will be able to host your app either via Ngrok (recommended), Glitch, or another service. You will need to do this set your OAuth redirect URLs as shown in the screenshot below.
With Ngrok, to start your app, first use the ngrok http 3000
command to start ngrok. From there, copy and paste your
forwarding address into your manifest file as shown in the screenshots below. Make sure to start the node app with Node app.js
as well, so that all requests can be fowarded to Ngrok from your app.
- Open https://api.slack.com/apps/new and choose "From an app manifest"
- Choose the workspace you want to install the application to
- Copy the contents of manifest.json into the text box that says
*Paste your manifest code here*
(within the JSON tab) and click Next. Make sure to change the URLs on themanifest.json
in three specific places, as shown in the screenshot below.
- Review the configuration and click Create
- Click Install to Workspace and Allow on the screen that follows. You'll then be redirected to the App Configuration dashboard.
- Click on
Manage Distribution
and then make sure all boxes have green check marks. SelectRemove Hard Coded Information
, check the box and thenActivate Public Distribution
.
Before you can run the app, you'll need to store some environment variables.
- Copy
.env.sample
to.env
- Click Basic Information from the left hand menu. There, in the
App Credentials
you should see yourSLACK_CLIENT_ID
,SLACK_CLIENT_SECRET
, andSLACK_SIGNING_SECRET
. Click onShow
and copy and paste those values into your.env
file. - This app uses (the free version of) MongoDB. You'll need to provide your MongoDB username, password, and database name in the
.env
file:DB_USERNAME
,DB_PASSWORD
, andDB_NAME
. You can feel free to leave the DB_NAME asslack_connect_test
.
Below, you can see a screenshot of my database configuration. The DB_NAME
is slack_connect_test
and the collection is named users
.
Don't forget to save your
.env
and then runsource .env
to set your env variables.
npm install
npm start
Great job! You're now ready to install the app using Slack's OAuth process.
Watch the video below (sound on) to understand how to install the app. Note that the video is showing the install path from a Ngrok URL. The base URL will always we different, based on if you are using Ngrok or Glitch, and depending on what your app is named on Glitch / what forwarding address is used in Ngrok.
installAppWorkspace.mov
Next, navigate to your install endpoint. Since we are using Bolt, this endpoint is automatically created for us from the Bolt package.
- If you are using Glitch (and assuming your app is hosted at
https://bolt-template-slack-connect.glitch.me
), you can navigate tohttps://bolt-template-slack-connect.glitch.me/slack/install
If you are using Ngrok, it should look something likehttps://3cb89939.ngrok.io/slack/install
- Click on the
Add to Slack
button. - Pick a workspace to install the app to from the top-right corner.
- Click on the green
Allow
button. - You will be redirected to the Redirect URL. Click on "Open Slack".
- Once you click on "Open Slack" your browser, you will be taken to the messages tab of your new Slack Connect Admin app! 🎉