Slack workspaces become significantly more efficient with Clawdbot integration. OpenClaw handles routine questions, schedules meetings, and provides instant information access. Teams report 40% reduction in time spent on administrative tasks after deploying OpenClaw.
Prerequisites
- OpenClaw CLI installed (
npm install -g openclaw-cli) - Slack workspace with admin permissions
- Node.js 16+ and npm 8+
- Basic understanding of Slack apps
1Create Slack App
Start by creating a new Slack application in your workspace:
- Visit api.slack.com/apps
- Click "Create New App"
- Choose "From scratch"
- Name your app (e.g., "Team Assistant")
- Select your workspace
2Configure Bot Permissions
Navigate to "OAuth & Permissions" and add these Bot Token Scopes:
Required Scopes:
- app_mentions:read
- channels:history
- channels:read
- chat:write
- chat:write.public
- commands
- groups:history
- groups:read
- im:history
- im:read
- im:write
- users:read
- reactions:write
3Enable Event Subscriptions
In "Event Subscriptions", enable events and subscribe to:
Bot Events:
- app_mention
- message.channels
- message.groups
- message.im
You'll need a public URL for the Request URL. We'll set this up after deploying OpenClaw.
4Initialize OpenClaw for Slack
Create a new OpenClaw project configured for Slack:
openclaw init slack-bot --platform slack
cd slack-bot
Project structure:
slack-bot/
├── openclaw.config.js
├── .env.example
├── commands/
│ ├── help.js
│ └── status.js
├── events/
│ ├── message.js
│ └── app_mention.js
└── package.json
5Configure Environment Variables
Copy .env.example to .env and add your Slack credentials:
# Slack Configuration
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_APP_TOKEN=xapp-your-app-token
# OpenClaw Settings
OPENCLAW_API_KEY=your_openclaw_api_key
OPENCLAW_PORT=3000
OPENCLAW_MODE=production
# Optional Features
ENABLE_SLASH_COMMANDS=true
ENABLE_SHORTCUTS=true
LOG_LEVEL=info
- Bot Token: OAuth & Permissions → Bot User OAuth Token
- Signing Secret: Basic Information → App Credentials → Signing Secret
- App Token: Basic Information → App-Level Tokens (create one with connections:write scope)
6Customize Bot Configuration
Edit openclaw.config.js for your team's needs:
module.exports = {
name: 'Team Assistant',
// AI Configuration
ai: {
model: 'openclaw-v2',
temperature: 0.7,
maxTokens: 500,
contextWindow: 15
},
// Slack-specific settings
slack: {
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
token: process.env.SLACK_BOT_TOKEN
},
// Feature toggles
features: {
slashCommands: true,
shortcuts: true,
homeTab: true,
messageActions: true
},
// Response templates
responses: {
greeting: 'Hi there! :wave: How can I help you today?',
thinking: 'Let me think about that... :thinking_face:',
error: 'Oops! Something went wrong. Please try again.',
noPermission: 'Sorry, you need admin permissions for that.'
}
};
7Create Slash Commands
Add a custom slash command in commands/team-status.js:
module.exports = {
command: '/team-status',
description: 'Check team availability',
async execute({ command, ack, say, client }) {
await ack();
try {
const users = await client.users.list();
const activeUsers = users.members.filter(u =>
!u.is_bot && u.presence === 'active'
);
await say({
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: `*Team Status* :chart_with_upwards_trend:\n${activeUsers.length} members online`
}
},
{
type: 'divider'
},
{
type: 'section',
fields: activeUsers.slice(0, 10).map(u => ({
type: 'mrkdwn',
text: `:green_circle: <@${u.id}>`
}))
}
]
});
} catch (error) {
await say('Error fetching team status');
}
}
};
8Install App to Workspace
Install your app to the Slack workspace:
- Go to "Install App" in your app settings
- Click "Install to Workspace"
- Review permissions and authorize
- Copy the Bot User OAuth Token to your
.envfile
9Start OpenClaw
Launch your Slack bot:
openclaw dev
Expected output:
🚀 OpenClaw Slack Bot Starting...
✓ Configuration loaded
✓ Socket mode enabled
✓ Connected to Slack
✓ Slash commands registered: 3
✓ Event handlers loaded: 4
✓ Bot online: Team Assistant
→ Listening for messages and commands!
@Team Assistant in any channel or using your slash commands.
Advanced Features
Interactive Messages
Create interactive buttons and menus:
// events/interactive.js
module.exports = {
async execute({ body, ack, say, client }) {
await ack();
const action = body.actions[0];
if (action.action_id === 'approve_request') {
await say({
text: 'Request approved! :white_check_mark:',
thread_ts: body.message.ts
});
}
}
};
Home Tab
Customize the app's home tab:
// events/app_home_opened.js
module.exports = {
async execute({ event, client }) {
await client.views.publish({
user_id: event.user,
view: {
type: 'home',
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*Welcome to Team Assistant!* :house:'
}
},
{
type: 'actions',
elements: [
{
type: 'button',
text: { type: 'plain_text', text: 'Get Help' },
action_id: 'help_button'
}
]
}
]
}
});
}
};
Production Deployment
Deploy to production with PM2:
# Install PM2
npm install -g pm2
# Start bot
pm2 start openclaw --name slack-bot -- start
# Enable auto-restart
pm2 startup
pm2 save
# Monitor
pm2 logs slack-bot
Troubleshooting
- Bot doesn't respond: Check Socket Mode is enabled and App Token is valid
- Permission errors: Verify all required scopes are added
- Slash commands not working: Ensure commands are registered in Slack app settings
- Connection issues: Validate all tokens in .env file
For additional support, join the OpenClaw Slack community or consult our troubleshooting documentation.