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

  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:
{
     "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
     }
   }
  1. 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: GitHub Integration Setup (Optional)

The bot supports GitHub integration for enhanced repository operations. You can choose between two authentication methods:

GitHub Apps provide better security, granular permissions, and higher API rate limits compared to personal access tokens.

Step-by-Step GitHub App Setup:

  1. Create a GitHub App:
  2. Go to GitHub Settings → Developer settings → GitHub Apps
  3. Click "New GitHub App"
  4. 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)
  5. Configure App Permissions:

  6. Repository permissions:
    • Contents: Read & Write
    • Issues: Read & Write
    • Pull requests: Read & Write
    • Metadata: Read
  7. Account permissions (if needed):

    • Members: Read
    • Organization administration: Read
  8. Generate Authentication Credentials:

  9. In the app settings, scroll to "Private keys"
  10. Click "Generate a private key"
  11. Download the .pem file and keep it secure
  12. Note the App ID (displayed at the top of the settings page)

  13. Install the App:

  14. Click "Install App" in the left sidebar
  15. Choose the account/organization to install on
  16. Select repositories (all or specific ones)
  17. Note the Installation ID from the URL after installation (e.g., https://github.com/settings/installations/12345678)

  18. Prepare Configuration Values:

  19. App ID: From step 3
  20. Private Key: Content of the .pem file
  21. Installation ID: From step 4

Option B: Personal Access Token (Legacy)

For simpler setups or testing purposes:

  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

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

  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. For GitHub Integration (choose one option):

  11. Option A - GitHub App (Recommended):
    • GitHub App ID: Your GitHub App ID
    • GitHub Private Key: Content of your .pem file
    • GitHub Installation ID: Your installation ID
  12. 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.

  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 - 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

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 App integration for enhanced security and functionality
  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.