Bidirectional Slack integration allowing you to:
- Claude → Slack: Automatic notifications when Claude Code events occur
- Slack → Claude: Send responses from mobile and use them in Claude Code
- Phase 1 (This Guide): Manual
/checkcommand - Simple, stable, works immediately - Phase 2 (Auto-Injection): Fully hands-free - See PHASE2_README.md
┌──────────────────┐ Hooks ┌───────────────┐
│ Claude Code │────────────────────────>│ Slack │
│ │ (auto-notify) │ Workspace │
│ │ │ │
│ │<────────────────────────│ │
│ │ /check (manual read) └───────────────┘
└──────────────────┘ │
│ WebSocket
│ (Socket Mode)
▼
┌─────────────────────┐
│ slack_listener.py │
│ (runs separately) │
│ Saves to: │
│ slack_response.txt │
└─────────────────────┘
- ✅ Claude Code automatically sends messages to Slack on key events
- ✅ You reply in Slack (mobile-friendly)
- ✅ Type
/checkin Claude Code to retrieve response - ✅ Works with simple text responses: "1", "2", "3", or custom text
- ✅ Slack bot acknowledges receipt with ✅ reaction
- ✅ Automatic response injection (no manual
/checkneeded) - ✅ Sub-second latency from Slack → Claude
- ✅ Fully hands-free mobile control
- 📖 See PHASE2_README.md for setup
- ✅ Unlimited concurrent Claude sessions
- ✅ Thread-based organization in Slack
- ✅ Session picker UI for mobile
- ✅ Auto-routing by thread
- ✅ VibeTunnel compatibility
- ✅ Backward compatible with Phase 2
- 📖 See PHASE25_README.md for full guide
Quick Start Phase 2.5:
# Start registry + Slack bot (one time)
cd slack_bot && ./start-all
# Start multiple Claude sessions (separate terminals)
cd /path/to/project1 && ./claude-slack
cd /path/to/project2 && ./claude-slack
cd /path/to/project3 && ./claude-slack
# Use from mobile: Select thread in Slack, reply- Interactive buttons (1️⃣ 2️⃣ 3️⃣), session pause/resume, team collaboration
- Slack Workspace: You must have admin access to create apps
- Python 3.8+: For running the Slack bot
- Claude Code: Installed and working
-
Go to Slack API: https://api.slack.com/apps
-
Create New App:
- Click "Create New App"
- Choose "From scratch"
- App Name: "Claude Code Bot" (or any name)
- Select your workspace
- Click "Create App"
-
Enable Socket Mode:
- In left sidebar → Settings → Socket Mode
- Toggle "Enable Socket Mode" → ON
- Click "Generate an app-level token"
- Token Name: "Socket Mode Token"
- Scope:
connections:write - Click "Generate"
- COPY THE TOKEN (starts with
xapp-) → Save for later - Click "Done"
-
Add Bot Token Scopes:
- In left sidebar → Features → OAuth & Permissions
- Scroll to "Scopes" → "Bot Token Scopes"
- Click "Add an OAuth Scope" and add these:
app_mentions:read- Read @mentionschannels:history- Read channel messageschannels:read- List channelschat:write- Send messagesim:history- Read DMsim:read- Access DM infoim:write- Send DMsreactions:write- Add emoji reactions
-
Install App to Workspace:
- Scroll up on same page → "OAuth Tokens for Your Workspace"
- Click "Install to Workspace"
- Review permissions → Click "Allow"
- COPY THE BOT TOKEN (starts with
xoxb-) → Save for later
-
Subscribe to Events:
- In left sidebar → Features → Event Subscriptions
- Toggle "Enable Events" → ON
- Scroll to "Subscribe to bot events"
- Click "Add Bot User Event" and add:
app_mention- When someone @mentions your botmessage.channels- Messages in channelsmessage.im- Direct messages
- Click "Save Changes"
-
Create Channel (optional but recommended):
- In Slack, create a new channel:
#btcbot-claude - Invite the bot: Type
/invite @Claude Code Botin the channel - This will be your dedicated channel for Claude notifications
- In Slack, create a new channel:
-
Navigate to project:
cd /Users/danielbennett/codeNew/btcbot/slack_bot -
Install dependencies:
pip install -r requirements.txt
-
Create .env file:
cp .env.example .env
-
Edit .env file with your tokens:
# Open in your editor nano .env # Or code .env
Replace with your actual tokens:
SLACK_BOT_TOKEN=xoxb-YOUR-ACTUAL-BOT-TOKEN SLACK_APP_TOKEN=xapp-YOUR-ACTUAL-APP-TOKEN SLACK_CHANNEL=#btcbot-claude -
Test the bot:
python3 slack_listener.py
You should see:
🚀 Starting Slack bot... 📁 Response file: /Users/danielbennett/codeNew/btcbot/slack_response.txt ✅ Slack bot is running! Listening for: - @mentions in channels - Direct messages - Channel messages starting with / or ! - Single digit responses (1, 2, 3) Press Ctrl+C to stop -
Test in Slack:
- Go to
#btcbot-claudechannel - Type:
@Claude Code Bot test - Bot should:
- Add ✅ reaction to your message
- Reply: "✅ Got it! Saved response: test"
- Check terminal: Should show "📝 Saved mention..."
- Check file exists:
ls -la ../slack_response.txt
- Go to
-
Keep bot running:
- Open a new terminal tab/window for the bot
- Or use
tmux/screento run in background - Or use
nohup python3 slack_listener.py &
-
Navigate to project root:
cd /Users/danielbennett/codeNew/btcbot -
Create settings file:
cp .claude/settings.local.json.example .claude/settings.local.json
-
Edit settings with your bot token:
nano .claude/settings.local.json # Or code .claude/settings.local.jsonReplace
xoxb-your-bot-token-herewith your actual bot token:{ "env": { "SLACK_BOT_TOKEN": "xoxb-YOUR-ACTUAL-BOT-TOKEN", "SLACK_CHANNEL": "#btcbot-claude" }, "hooks": { ... } } -
Verify hook is executable:
ls -la .claude/hooks/slack_bidirectional.py
Should show
-rwxr-xr-x(x = executable)If not:
chmod +x .claude/hooks/slack_bidirectional.py
-
Start Claude Code:
claude
-
Send a test prompt:
You: "Test Slack integration" -
Check Slack:
- Go to
#btcbot-claudechannel - You should see a message like:
📝 UserPromptSubmit ```Session: abc12345 Project: btcbot Prompt: Test Slack integration``` _Reply with: 1, 2, 3, or custom text_
- Go to
-
Reply in Slack (from mobile or desktop):
yes, proceed -
Check for response in Claude Code:
You: /checkYou should see:
============================================================ 📱 SLACK RESPONSE: ============================================================ yes, proceed ============================================================ You can now type this response in Claude Code (or just press Enter to accept it) -
Type response in Claude Code:
You: yes, proceed -
Success! 🎉 You now have bidirectional Slack integration
-
Start Claude Code session (on laptop):
cd /Users/danielbennett/codeNew/btcbot claude -
Work with Claude - Claude will auto-notify Slack on:
- Every prompt you send (
UserPromptSubmitevent) - When Claude finishes (
Stopevent)
- Every prompt you send (
-
Claude asks a question:
Claude: "Should I proceed with this analysis? (y/n)" -
Check Slack on mobile - You'll see:
✅ Stop Session: abc12345 Project: btcbot Claude has finished processing. Reply with: 1, 2, 3, or custom text -
Reply in Slack (mobile):
- Type
1(yes) - Or
2(always allow) - Or
3(no) - Or any custom text: "yes, use RSI 30"
- Type
-
Back at laptop, check for response:
You: /check -
See response:
============================================================ 📱 SLACK RESPONSE: ============================================================ 1 ============================================================ -
Type response in Claude:
You: 1(Or just type the custom text)
-
Claude continues with your response
/check- Check for Slack responses1- Common response (yes/proceed)2- Common response (always allow)3- Common response (no/decline)
Check bot is running:
# In slack_bot directory
ps aux | grep slack_listenerIf not running:
cd slack_bot
python3 slack_listener.pyCheck bot is in channel:
- Type
/invite @Claude Code Botin the Slack channel - Bot must be explicitly invited to channels
Check permissions:
- Slack App → OAuth & Permissions → verify all scopes listed above
Check token in settings:
cat .claude/settings.local.json
# Verify SLACK_BOT_TOKEN is set correctlyCheck hook is executable:
ls -la .claude/hooks/slack_bidirectional.py
chmod +x .claude/hooks/slack_bidirectional.py # If neededCheck slack_sdk is installed:
pip install slack-sdkTest hook manually:
echo '{"session_id": "test123", "project_dir": "/test"}' | \
HOOK_EVENT_TYPE=UserPromptSubmit \
SLACK_BOT_TOKEN=xoxb-YOUR-TOKEN \
SLACK_CHANNEL=#btcbot-claude \
python3 .claude/hooks/slack_bidirectional.pyCheck file exists:
ls -la slack_response.txt
cat slack_response.txtCheck bot wrote to file:
- Send test message in Slack
- Check if file was created/updated
- Check bot terminal for error messages
File permissions:
# Ensure file is writable
chmod 644 slack_response.txt # If it existsCheck logs:
- Look at terminal output where bot is running
- Common issues:
- Token expired/invalid
- Network connection lost
- Rate limiting
Restart bot:
cd slack_bot
python3 slack_listener.pyCheck Slack App status:
- https://api.slack.com/apps
- Your App → Settings → Basic Information
- Verify "Install to Workspace" is active
btcbot/
├── slack_bot/
│ ├── slack_listener.py # Main Slack bot (runs continuously)
│ ├── requirements.txt # Python dependencies
│ ├── .env.example # Template for configuration
│ ├── .env # Your tokens (gitignored)
│ └── README.md # This file
│
├── .claude/
│ ├── hooks/
│ │ └── slack_bidirectional.py # Claude Code hook
│ ├── commands/
│ │ └── check.md # /check slash command
│ ├── settings.local.json.example # Template
│ └── settings.local.json # Your config (gitignored)
│
└── slack_response.txt # Shared file for responses (gitignored)
- Never commit tokens:
.envandsettings.local.jsonare gitignored - Rotate tokens periodically: Recommended every 90 days
- Use separate bot token: Don't use your personal user token
- Limit channel access: Only invite bot to channels that need it
- Monitor usage: Check Slack App dashboard for suspicious activity
- Build
claude_wrapper.pyto proxy stdin/stdout - Automatically inject Slack responses (no manual
/check) - Estimated time: 3-4 hours
- Interactive buttons (1️⃣ Yes 2️⃣ Always 3️⃣ No)
- Threaded messages for context
- Button 4️⃣ for additional context
- Rich formatting, code blocks
- Estimated time: 2-3 hours
For issues:
- Check troubleshooting section above
- Verify all setup steps completed
- Check bot terminal logs
- Check Claude Code output for hook errors
Same as parent project (btcbot)