Step-by-Step Guide to Creating a Slack Bot and Getting Your Bot & App Token

Vir Surya IrcasVir Surya Ircas
2 min read

📝 Introduction

Slack bots are powerful tools that can automate tasks, send alerts, or even serve as mini apps within your workspace. One of the key features of the Slack platform is it supports Bot and App Token, by this we can customize their behavior based on our specific needs.

🔧 Step 1: Create a New Slack App

  1. Go to api.slack.com/apps and click “Create New App”

  2. It will pop showing two options, choose “From scratch”

  3. Enter your App Name & Pick your Workspace, click “Create App

  4. Thats it, your Slack Bot is created successfully!

🤖 Step 2: Get the Slack Bot Token

  1. Navigate to “OAuth & Permissions” under Features menu. At first “OAuth Tokens” is disabled, because of lack of permission.

  2. Scroll down to “Scopes” section, under Bot Token Scopes add these 3 “OAuth Scope” to give permission to your bot.

  3. Now, scroll to top “OAuth Tokens” is enabled, as it got enough permissions. Click “Install to XXX

  4. Bot will be requesting permission to access your workspace, click “Allow”

  5. Thats it, your Slack Bot Token is created successfully!

⚙️ Step 3: Get the Slack App Token

  1. Navigate to “Basic Information” under Settings menu

  2. Scroll little bit down to App-Level Tokens section & click “Generate Token and Scopes”

  3. Enter your Token Name and Add Scope as connections:write, then click “Generate”

  4. Thats it, your Slack App Token is created successfully!

🌟Bonus: Set Commands to the Bot

  1. To set commands without request URL we need to enable Socket Mode

  2. Navigate to Socket Mode under Settings menu toggle ON the “Enable Socket Mode”

  3. Navigate to “Slack Commands” under Features menu, click Create New Command

  4. Simply enter the command you want and its description, click Save. Add whatever commands you want to set to your bot.

  5. Thats it, Commands are set to the bot successfully!

    🏁 Conclusion

    To allow your app to send messages to a Slack channel. Select the channel you want, go to Integrations → Apps → Add an app, then select your app from the list. That’s it — your app is now successfully added to the channel!

0
Subscribe to my newsletter

Read articles from Vir Surya Ircas directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vir Surya Ircas
Vir Surya Ircas