Start tracking your progress
Trailhead Home
Trailhead Home

Authorize Your Bot

Discover gives you a launching pad to begin building your Slack App. Time to dive in!

  1. Navigate to and click Start Building.
    The Start Building button on the Slack API site.
  2. Click Create New App. This takes you to the Create a Slack App menu where you can name your bot.
    In the Create a Slack App input screen, you can name your Slack App, identify the workspace, and ultimately commit the Slack App for creation.
  3. Name your bot Welcome Trailhead.
  4. Select your newly created workspace.
  5. Click Create App.
  6. Make sure your Slack App is selected in the API screen, as indicated in the top left of the screen above the navigation menu.

From here, it’s all about setting up permissions.

Set Up Permissions

Slack gives you the ability to control how, where, and when your Slack App posts and retrieves information. This is done through Permissions. Permissions keep your Slack App secure and let you be transparent to your users about what you’re doing with it.

There’s a lot of Permissions available but we focus on the critical ones for this project— chat:write:bot and users:read.



Before you can do anything with your Slack App, you must give it the appropriate permissions through the use of Permission Scopes.

  1. Select OAuth and Permissions from the left-hand menu.
  2. Scroll down to the Scopes section and search for and select chat:write:bot from the dropdown.
    The Select Permission Scopes menu lets you search for the appropriate permissions to select for you Slack App, including chat:write:bot.
  3. Also search for and select users:read.
    Selecting users:read in the Select Permission Scopes menu gives your bot access to the workspace profile information.
  4. Click Save Changes.

While there is a short description of the permissions on screen, let’s dig a little deeper so we know exactly what they’re doing.

  • The chat:write:bot permission gives you the ability to send people messages as your bot user.
  • The users:read permission lets you access your workspace’s profile information. It’s also necessary for you to detect a new user.

Install Your Slack App to Your Workspace

The concept of installing your Slack App can seem strange since you haven’t built anything yet. But in this case, “installing” means to associate your Slack App with your workspace, and officially grant it access according to the permissions you gave in the previous step.

  1. Scroll back to the top and click Install App to Workspace.
  2. On the next screen, click Authorize. You’ll be taken back to the OAuth and Permissions page, which should now display an OAuth Access Token—a string of characters that starts with “xoxp.” This token lets Slack know that your Slack App has the right permissions you’ve set up.
    The Tokens for Your Workspace section enables you to copy the OAuth Access Token with a click.
  3. Click Copy on the token field. This comes into play later.

Make the Token Usable by Your App

It’s time to make your token usable by your code. You do this in your text editor.

  1. Go to your text editor. In the editor, you should still have your first-slack-app folder open, along with a file on the side package.json.
  2. Create a new file. You can do this by selecting File then New or New File in the menu.
  3. Without typing anything, click File again, then Save As, and save the file as .env.
  4. Now enter your token. To do this, replace <place token here> with your token in the following line SLACK_TOKEN=<place token here> in line one of the .env file.
  5. Save this file again.

Congratulations, you’ve made your token usable by your code! This step gives you authorization to use the Slack APIs. Now let’s start giving your code the power to do stuff.

We won't check any of your setup. Click Verify Step to go to the next step in the project.