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

  1. Visit api.slack.com/apps
  2. Click "Create New App"
  3. Select "From an app manifest"
  4. Choose your workspace
  5. 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 } }
  6. 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

  1. Install the app to your workspace:
  2. Go to "Install App" in your app settings
  3. Click "Install to Workspace"
  4. Authorize the required permissions

  5. Copy the Bot User OAuth Token:

  6. Navigate to "OAuth & Permissions"
  7. Copy the "Bot User OAuth Token" (starts with xoxb-)

  8. Generate App-Level Token:

  9. Go to "Basic Information" → "App-Level Tokens"
  10. Click "Generate Token and Scopes"
  11. Add connections:write scope
  12. Copy the generated token (starts with xapp-)

  13. Get Signing Secret:

  14. In "Basic Information" section
  15. Copy the "Signing Secret"

Step 3: Create GitHub Token (Optional)

For GitHub integration capabilities:

  1. Go to GitHub Settings → Developer settings → Personal access tokens
  2. Click "Generate new token (classic)"
  3. Select appropriate scopes based on your needs:
  4. repo - for private repository access
  5. public_repo - for public repository access
  6. read:org - for organization access
  7. Generate and copy the token

Step 4: Deploy via Open Source Cloud

  1. Access the service:
  2. Visit https://app.osaas.io/browse/mpociot-claude-code-slack-bot
  3. Click on the service to deploy

  4. Configure instance options:

  5. Name: Give your instance a descriptive name
  6. Slack Bot Token: Your xoxb- token
  7. Slack App Token: Your xapp- token
  8. Slack Signing Secret: From your app's Basic Information
  9. Anthropic API Key: Your Claude API key
  10. 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.

  1. Deploy the service:
  2. Review your configuration
  3. Click deploy
  4. Wait for the service to start

Step 5: Test Your Bot

  1. Invite the bot to a channel: /invite @your-bot-name

  2. Test direct messaging:

  3. Send a direct message to the bot
  4. Try asking for coding help or explanations

  5. Test in threads:

  6. Start a conversation in a thread
  7. 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

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:

  1. Train your team on how to interact with the bot effectively
  2. Set up dedicated channels for coding discussions
  3. Explore advanced features like GitHub integration
  4. Monitor usage and optimize configurations
  5. 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.