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

📝 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
Go to api.slack.com/apps and click “Create New App”
It will pop showing two options, choose “From scratch”
Enter your App Name & Pick your Workspace, click “Create App”
Thats it, your Slack Bot is created successfully!
🤖 Step 2: Get the Slack Bot Token
Navigate to “OAuth & Permissions” under Features menu. At first “OAuth Tokens” is disabled, because of lack of permission.
Scroll down to “Scopes” section, under Bot Token Scopes add these 3 “OAuth Scope” to give permission to your bot.
Now, scroll to top “OAuth Tokens” is enabled, as it got enough permissions. Click “Install to XXX”
Bot will be requesting permission to access your workspace, click “Allow”
Thats it, your Slack Bot Token is created successfully!
⚙️ Step 3: Get the Slack App Token
Navigate to “Basic Information” under Settings menu
Scroll little bit down to App-Level Tokens section & click “Generate Token and Scopes”
Enter your Token Name and Add Scope as connections:write, then click “Generate”
Thats it, your Slack App Token is created successfully!
🌟Bonus: Set Commands to the Bot
To set commands without request URL we need to enable Socket Mode
Navigate to Socket Mode under Settings menu toggle ON the “Enable Socket Mode”
Navigate to “Slack Commands” under Features menu, click Create New Command
Simply enter the command you want and its description, click Save. Add whatever commands you want to set to your bot.
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!
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
