Getting Started with Claude Code Slack Bot
The Claude Code Slack Bot brings AI-powered coding assistance directly to your Slack workspace, enabling seamless collaboration and productivity enhancement for development teams.
Overview
Service URL: https://app.osaas.io/browse/mpociot-claude-code-slack-bot
Key Features
- AI-driven coding assistance in Slack
- Thread-based conversations with context maintenance
- Streaming responses for real-time interaction
- Markdown formatting support
- Working directory management
- Open-source with no vendor lock-in
Prerequisites
Before setting up the Claude Code Slack Bot, ensure you have:
- Node.js 18+ installed
- A Slack workspace with admin permissions
- An Anthropic API key for Claude access
- (Optional) GitHub token for repository integration
Step-by-Step Setup Instructions
Step 1: Create a Slack App
Method 1: Using App Manifest (Recommended)
- Visit api.slack.com/apps
- Click "Create New App"
- Select "From an app manifest"
- Choose your workspace
- Copy the following manifest content:
json { "display_information": { "name": "Claude Code Bot", "description": "AI-powered coding assistant using Claude Code SDK", "background_color": "#4A154B", "long_description": "This bot integrates Claude Code SDK with Slack to provide AI-powered coding assistance directly in your workspace. It supports streaming responses, maintains conversation context, and can help with code reviews, debugging, and general programming questions." }, "features": { "app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false }, "bot_user": { "display_name": "Claude Code", "always_online": true } }, "oauth_config": { "scopes": { "bot": [ "app_mentions:read", "channels:history", "chat:write", "chat:write.public", "im:history", "im:read", "im:write", "users:read", "reactions:read", "reactions:write" ] } }, "settings": { "event_subscriptions": { "bot_events": [ "app_mention", "message.im", "member_joined_channel" ] }, "interactivity": { "is_enabled": false }, "org_deploy_enabled": false, "socket_mode_enabled": true, "token_rotation_enabled": false } }
- Paste the manifest content and create the app
Method 2: Manual Setup
If you prefer manual setup, create a new Slack app and configure: - Bot token scopes - Event subscriptions - Socket mode - App-level tokens
Step 2: Configure Slack App Permissions
- Install the app to your workspace:
- Go to "Install App" in your app settings
- Click "Install to Workspace"
-
Authorize the required permissions
-
Copy the Bot User OAuth Token:
- Navigate to "OAuth & Permissions"
-
Copy the "Bot User OAuth Token" (starts with
xoxb-
) -
Generate App-Level Token:
- Go to "Basic Information" → "App-Level Tokens"
- Click "Generate Token and Scopes"
- Add
connections:write
scope -
Copy the generated token (starts with
xapp-
) -
Get Signing Secret:
- In "Basic Information" section
- Copy the "Signing Secret"
Step 3: Create GitHub Token (Optional)
For GitHub integration capabilities:
- Go to GitHub Settings → Developer settings → Personal access tokens
- Click "Generate new token (classic)"
- Select appropriate scopes based on your needs:
repo
- for private repository accesspublic_repo
- for public repository accessread:org
- for organization access- Generate and copy the token
Step 4: Deploy via Open Source Cloud
- Access the service:
- Visit https://app.osaas.io/browse/mpociot-claude-code-slack-bot
-
Click on the service to deploy
-
Configure instance options:
- Name: Give your instance a descriptive name
- Slack Bot Token: Your
xoxb-
token - Slack App Token: Your
xapp-
token - Slack Signing Secret: From your app's Basic Information
- Anthropic API Key: Your Claude API key
- GitHub Token: (Optional) Your GitHub personal access token
Recommended: Store sensitive tokens and API keys as service secrets in Open Source Cloud for enhanced security. See the Working with Secrets guide for detailed instructions.
- Deploy the service:
- Review your configuration
- Click deploy
- Wait for the service to start
Step 5: Test Your Bot
-
Invite the bot to a channel:
/invite @your-bot-name
-
Test direct messaging:
- Send a direct message to the bot
-
Try asking for coding help or explanations
-
Test in threads:
- Start a conversation in a thread
- Verify context is maintained across messages
Usage Examples
Basic Coding Help
@claude-code-bot Can you help me write a Python function to reverse a string?
Code Review
@claude-code-bot Please review this JavaScript code:
```javascript
function calculateTotal(items) {
let total = 0;
for (let i = 0; i < items.length; i++) {
total += items[i].price;
}
return total;
}
Debugging Assistance
@claude-code-bot I'm getting a "Cannot read property 'length' of undefined" error. Here's my code...
Troubleshooting
Common Issues
Bot not responding: - Verify all tokens are correctly configured - Check that the bot is invited to the channel - Ensure the service is running in Open Source Cloud dashboard
Permission errors: - Verify bot has necessary scopes in Slack app settings - Ensure app is installed to workspace
Authentication issues: - Double-check all API keys and tokens - Verify GitHub token has appropriate scopes if using GitHub features
Support
- Open Source Cloud Support: Contact support through the Open Source Cloud platform
- Community: Join discussions in the Open Source Cloud Slack community
Usage
Running an instance of this service consumes 10 usage tokens from your Open Source Cloud account.
Security Considerations
- Store all tokens and API keys as service secrets in Open Source Cloud (see Working with Secrets guide)
- Regularly rotate access tokens
- Monitor bot usage and access logs
- Restrict bot permissions to necessary channels only
- Review code shared with the bot for sensitive information
Next Steps
Once your Claude Code Slack Bot is running:
- Train your team on how to interact with the bot effectively
- Set up dedicated channels for coding discussions
- Explore advanced features like GitHub integration
- Monitor usage and optimize configurations
- Consider integrating with your existing development workflows
The Claude Code Slack Bot transforms your development process by bringing powerful AI assistance directly into your team's communication hub.