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
- GitHub integration with App support for enhanced security
- Open-source with no vendor lock-in
Video Tutorial
Watch the complete setup guide: Claude Code Slackbot Setup Tutorial
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 App or personal access 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:
{
"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",
"channels:read"
]
}
},
"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:writescope -
Copy the generated token (starts with
xapp-) -
Get Signing Secret:
- In "Basic Information" section
- Copy the "Signing Secret"
Step 3: GitHub Integration Setup (Optional)
The bot supports GitHub integration for enhanced repository operations. You can choose between two authentication methods:
Option A: GitHub App Integration (Recommended)
GitHub Apps provide better security, granular permissions, and higher API rate limits compared to personal access tokens.
Step-by-Step GitHub App Setup:
- Create a GitHub App:
- Go to GitHub Settings → Developer settings → GitHub Apps
- Click "New GitHub App"
-
Fill in the required fields:
- App name: Choose a unique name (e.g., "Claude Code Bot - [Your Organization]")
- Description: "AI-powered coding assistant for Slack"
- Homepage URL: Your organization's URL or the bot's documentation
- Webhook URL: Leave empty (not needed for this integration)
-
Configure App Permissions:
- Repository permissions:
- Contents: Read & Write
- Issues: Read & Write
- Pull requests: Read & Write
- Metadata: Read
-
Account permissions (if needed):
- Members: Read
- Organization administration: Read
-
Generate Authentication Credentials:
- In the app settings, scroll to "Private keys"
- Click "Generate a private key"
- Download the
.pemfile and keep it secure -
Note the App ID (displayed at the top of the settings page)
-
Install the App:
- Click "Install App" in the left sidebar
- Choose the account/organization to install on
- Select repositories (all or specific ones)
-
Note the Installation ID from the URL after installation (e.g.,
https://github.com/settings/installations/12345678) -
Prepare Configuration Values:
- App ID: From step 3
- Private Key: Content of the
.pemfile - Installation ID: From step 4
Option B: Personal Access Token (Legacy)
For simpler setups or testing purposes:
- 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
Note: GitHub Apps are recommended for production use as they provide better security, institutional identity, and don't depend on a specific user account.
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
-
For GitHub Integration (choose one option):
- Option A - GitHub App (Recommended):
- GitHub App ID: Your GitHub App ID
- GitHub Private Key: Content of your
.pemfile - GitHub Installation ID: Your installation ID
- Option B - Personal Access Token:
- GitHub Token: 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 - For GitHub App integration: Verify App ID, Installation ID, and private key are correct - For GitHub tokens: Verify token has appropriate scopes for your repositories
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 App integration for enhanced security and functionality
- 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.