Overview
klaw provides native Slack integration, allowing your team to interact with AI agents directly in Slack channels and threads. This guide walks you through setting up and configuring the integration.Prerequisites
- klaw installed and configured
- Slack workspace admin access
- API key configured
Step 1: Create a Slack App
Go to Slack API
Visit api.slack.com/apps and click Create New App.
Choose creation method
Select From scratch and give your app a name (e.g., “klaw”) and select your workspace.
Enable Socket Mode
Go to Socket Mode in the sidebar and enable it. Generate an App-Level Token with
connections:write scope. Save this as SLACK_APP_TOKEN.Configure OAuth scopes
Go to OAuth & Permissions and add these Bot Token Scopes:
app_mentions:read- Receive @mentionschat:write- Send messageschannels:history- Read channel messageschannels:read- View channel infogroups:history- Read private channel messagesgroups:read- View private channel infoim:history- Read DMsim:read- View DM infoim:write- Send DMsusers:read- View user info
Enable Events
Go to Event Subscriptions and enable events. Subscribe to these bot events:
app_mention- When someone @mentions the botmessage.channels- Messages in channelsmessage.groups- Messages in private channelsmessage.im- Direct messages
Step 2: Configure Environment
Set the required environment variables:~/.klaw/config.toml:
Step 3: Start klaw
Start the klaw platform with Slack integration:Step 4: Invite the Bot
In Slack, invite your bot to channels:- Go to the channel where you want the bot
- Type
/invite @klaw(or your bot’s name) - The bot is now active in that channel
Interacting with the Bot
@Mention the Bot
Thread Conversations
Start a thread and continue the conversation:Route to Specific Agents
Use@agent syntax to route to specific agents:
Setting Up Agents
Create agents for your Slack workspace:Scheduled Tasks (Cron)
Set up automated tasks in Slack:Create from CLI
Create from Slack
In Slack, tell the bot to create a cron job:cron_create tool automatically.
Manage Cron Jobs
Channel-Specific Monitoring
Set up monitoring for specific channels:- Reads new messages from the channel
- Analyzes them based on your criteria
- Responds in threads when matches are found
Configuration Options
Namespace Binding
Bind Slack channels to specific namespaces:Orchestrator Rules
Configure message routing:Best Practices
Limit channel access
Limit channel access
Only invite the bot to channels where it’s needed. This reduces noise and improves response relevance.
Use threads
Use threads
Encourage users to start threads for conversations. This keeps channels clean and maintains context better.
Set up dedicated channels
Set up dedicated channels
Consider creating dedicated channels like
#klaw-tasks or #ai-assistant for AI interactions.Configure rate limits
Configure rate limits
For busy channels, consider rate limiting to prevent overwhelming the system.
Troubleshooting
Bot doesn't respond
Bot doesn't respond
- Check if the bot is invited to the channel
- Verify Socket Mode is enabled in Slack app settings
- Check
klaw startoutput for errors - Ensure tokens are correctly set
Slow responses
Slow responses
- Check your API provider’s status
- Consider using a faster model (Haiku for simple tasks)
- Reduce the number of tools/skills for faster processing
Missing messages
Missing messages
- Ensure
channels:historyscope is granted - Check if the bot has access to the channel
- For private channels, add
groups:historyscope

