Slack Bot
This guide will help you set up the Qodo Slack Bot with support for both HTTP Webhook and Socket Mode approaches.
Choose Your Mode
Qodo CLI tool supports two communication modes with Slack:
HTTP Webhook Mode (default): Requires a public endpoint, best for production
Socket Mode: Works behind firewalls, great for development and enterprise environments
Public endpoint required
✅ Yes
❌ No
Works behind firewalls
❌ No
✅ Yes
Slack Marketplace compatible
✅ Yes
❌ No
Scalability
✅ Excellent
⚠️ Limited (10 connections)
Local development
⚠️ Needs tunneling
✅ Direct
Prerequisites
A Slack workspace where you have permission to install apps
A Qodo API key (get one from Qodo Dashboard)
Node.js and the Qodo CLI installed
Step 1: Create a Slack App
Go to Slack API Apps
Click "Create New App"
Choose "From scratch"
Enter your app name (e.g., "Qodo Bot")
Select your workspace
Click "Create App"
Step 2: Configure OAuth & Permissions
In your app settings, go to "OAuth & Permissions"
Scroll down to "Scopes" → "Bot Token Scopes"
Add the following scopes:
chat:write- Send messageschat:write.public- Send messages to channels the bot isn't inreactions:write- Add reactions to messageschannels:read- Read channel informationgroups:read- Read private channel informationim:read- Read direct message informationmpim:read- Read group direct message information
Scroll up and click "Install to Workspace"
Authorize the app
Copy the "Bot User OAuth Token" (starts with
xoxb-)
Step 3A: Configure Event Subscriptions (HTTP Webhook Mode)
Skip this step if you're using Socket Mode
Go to "Event Subscriptions" in your app settings
Turn on "Enable Events"
Set the Request URL to:
http://your-server.com/slack/eventsFor local development:
http://localhost:4444/slack/events(default port)For custom port:
http://localhost:YOUR_PORT/slack/eventsFor production: Use your actual server URL with HTTPS
Under "Subscribe to bot events", add:
app_mention- When your bot is mentionedmessage.channels- Messages in public channelsmessage.groups- Messages in private channelsmessage.im- Direct messagesmessage.mpim- Group direct messages
Click "Save Changes"
Step 3B: Configure Socket Mode (Socket Mode Only)
Skip this step if you're using HTTP Webhook Mode
Go to "Socket Mode" in your app settings
Toggle "Enable Socket Mode" to ON
Go to "Event Subscriptions" in your app settings
Turn on "Enable Events" (no Request URL needed for Socket Mode)
Under "Subscribe to bot events", add:
app_mention- When your bot is mentionedmessage.channels- Messages in public channelsmessage.groups- Messages in private channelsmessage.im- Direct messagesmessage.mpim- Group direct messages
Click "Save Changes"
Step 4A: Get Your Signing Secret (HTTP Webhook Mode Only)
Skip this step if you're using Socket Mode
Go to "Basic Information" in your app settings
Under "App Credentials", find "Signing Secret"
Click "Show" and copy the secret
Step 4B: Generate App-Level Token (Socket Mode Only)
Skip this step if you're using HTTP Webhook Mode
Go to "Basic Information" in your app settings
Scroll down to "App-Level Tokens"
Click "Generate Token and Scopes"
Enter a token name (e.g., "socket-mode-token")
Add the scope:
connections:writeClick "Generate"
Copy the token (starts with
xapp-)
Step 5: Configure Environment Variables
Copy the example environment file:
Edit
.envand fill in your values based on your chosen mode:
For HTTP Webhook Mode (default):
For Socket Mode:
Step 6: Find Your Bot User ID (Optional but Recommended)
In your Slack workspace, mention your bot:
@YourBotNameRight-click on the bot mention and select "Copy link"
The link will contain the user ID:
https://yourworkspace.slack.com/team/U1234567890Copy the
U1234567890part to your.envfile
Step 7: Test Your Setup
Start the Slack bot:
Or with a custom port:
You should see different output depending on your mode:
HTTP Webhook Mode:
Socket Mode:
In Slack, mention your bot:
The bot should respond with available commands.
Step 8: Configure Your Agent Commands
Create an agent configuration file (e.g., agent.toml):
Then start the bot with your agent file:
Switching Between Modes
You can easily switch between HTTP Webhook and Socket Mode by changing your environment variables:
Switch to Socket Mode:
Switch to HTTP Webhook Mode:
Restart the bot after making changes.
Troubleshooting
Bot Not Responding
For HTTP Webhook Mode:
Check that your webhook URL is accessible from the internet
Verify your bot token and signing secret are correct
Ensure your Slack app's Request URL is set correctly
For Socket Mode:
Verify your bot token and app-level token are correct
Check that Socket Mode is enabled in your Slack app settings
Ensure your app-level token has
connections:writescope
For Both Modes:
Check the bot has the required OAuth scopes
Make sure the bot is invited to the channel
Verify the bot is mentioned correctly (e.g.,
@YourBotName)
Environment Variable Errors
"SLACK_SIGNING_SECRET is required":
You're in HTTP Webhook mode but missing the signing secret
Either add the signing secret or switch to Socket Mode
"SLACK_APP_TOKEN is required":
You're in Socket Mode but missing the app-level token
Either add the app-level token or switch to HTTP Webhook mode
"Unknown command" Errors
Ensure your agent configuration file is loaded
Check that command names match exactly
Verify the agent file syntax is correct
Permission Errors
Make sure the bot has the required OAuth scopes
Check that the bot is invited to channels where you're trying to use it
Verify your Qodo API key is valid
Local Development
For local development, you'll need to expose your local server to the internet so Slack can send events to it. You can use tools like:
ngrok:
ngrok http 3000localtunnel:
lt --port 4444
Update your Slack app's Request URL with the public URL provided by these tools.
Production Deployment
For production:
Deploy your bot to a server with a public HTTPS URL
Update the Request URL in your Slack app settings
Set environment variables on your server
Ensure your server can handle Slack's event delivery requirements
Consider using a process manager like PM2 to keep the bot running
Usage Examples
Once set up, you can use the bot like this:
The bot maintains separate conversation sessions per thread, so you can have multiple ongoing conversations.
Last updated