-
Notifications
You must be signed in to change notification settings - Fork 14
Setup Greetbot in your Slack Workspace
This guide will show you how to set up your .env
file and add greetbot to our sandbox Slack workspace. If you don't have a Slack workspace yet, create one using their tutorial.
For security purposes, we don't include an .env
file. However, we do include an example file to give you an idea of environment variables that are needed for our app to work.
Duplicate the .env.example
file as .env
. You can leave SLACK_TOKEN
and SLACK_VERIFICATION_TOKEN
empty for now, but set DEV_SUBDOMAIN
as your name without space. For example,
DEV_SUBDOMAIN=angelocordon
We'll be using localtunnel to create a public url to your development server and for use with your sandbox workspace. Whatever you type in here will create a public url of DEV_SUBDOMAIN.localtunnel.me
or in this example, angelocordon.localtunnel.me
. You'll see this in action below.
-
Create a New App for Slack Visit Slack's API App Page and click on Create New App at the top right corner.
-
Fill in the App Name (as greetbot) and select your workspace for Development Slack Workspace. You may have to click on sign in if you don't see your workspace available.
In order to get all the right tokens, you must create a Bot User first. On the left hand side, navigate to Bot Users. Set Display Name
as greetbot
and Default Username
as greetbot
. Click on Save
.
-
Under the Basic Information page, scroll below to the App Credentials section and grab your
Verification Token
. Copy this in your.env
file asSLACK_VERIFICATION_TOKEN
. -
On the left hand menu, navigate down to OAuth and Permissions and grab the
Bot User OAuth Access Token
. This starts withxoxb
. Use this as yourSLACK_TOKEN
.
From here, when we refer to your localtunnel URL, we mean the URL generated from localtunnel. If you filled out the .env
file as noted above, it should be DEV_SUBDOMAIN.localtunnel.me
. You can also see this URL printed in the console after running npm run start:dev
.
-
On the left hand menu, navigate down to Interactive Components. Fill in the
Request URL
withyourlocaltunnelURL/interactive-message
. For example: (https://angelocordon.localtunnel.me/interactive-message
). -
From the left hand menu again, navigate down to Slash Commands and click on
Create New Command
. Fill in the information as follows:
Command: /welcome
Request URL: yourlocaltunnelurl/welcome
Short Description: Show the welcome text!
Important: Make sure to check off the option for Escape channels, users, and links sent to your app
located under Usage Hints
Click on Save
.
- Move on to Event Subscriptions. Fill in the
Request URL
withyourlocaltunnelURL/events
. This will send a post request to this URL. If you don't pass the verification:
-
First, make sure that your server is running (run
npm start:dev
in your console) or make sure that your tokens are listed correctly. See this step again for reference. -
If you still don't pass verification after checking the steps above, you can try running
npm run start:dev-server
andnpm run start:dev-tunnel
in two separate instances of your terminal.
Subscribe to both Workspace Events and Bot User Events with team_join
.
Lastly, install greetbot in your sandbox work place. Navigate back up to Basic Information and click on Install your app to your workplace.
Congratulations, you should have greetbot up and running with your sandbox channel 🎉 To try this out, type in /welcome test
in your Slack and you should get a private message from greetbot!
See a typo or could use more clarification? File an issue.