Service: Claude Code Slackbot - EyevinnOSC/community GitHub Wiki

Claude Code Slack Bot

The Claude Code Slack Bot (serviceId mpociot-claude-code-slack-bot) brings Claude Code coding assistance into your Slack workspace. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance that connects to Slack over Socket Mode. Source: mpociot/claude-code-slack-bot. Video tutorial: Claude Code Slackbot Setup Tutorial.

What it can do

  • Answer coding questions, review code and help debug, in channels, threads and direct messages.
  • Keep conversation context across messages in a thread and stream responses.
  • Format replies in Markdown and manage a working directory.
  • Access GitHub repositories, preferably through a GitHub App, or with a personal access token as a legacy fallback.

Creating an instance

Prerequisites: a Slack workspace where you can create apps, and optionally an Anthropic API key (the catalog marks it required; upstream it is only needed if you do not use a Claude subscription or Bedrock/Vertex) and a GitHub App or personal access token for repository access.

Step 1: Create the Slack app

Go to api.slack.com/apps, choose Create New App, then "From an app manifest", pick your workspace and paste this manifest (recommended; manual setup needs the same bot scopes, event subscriptions, Socket Mode and an app-level token):

{
  "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
  }
}

Then:

  1. Install the app to the workspace (Install App) and copy the Bot User OAuth Token from OAuth & Permissions (starts with xoxb-).
  2. Under Basic Information, App-Level Tokens, generate a token with the connections:write scope (starts with xapp-).
  3. Copy the Signing Secret from Basic Information.

Step 2: GitHub access (optional)

Option A, GitHub App (recommended: better security, granular permissions, higher rate limits, not tied to a user account):

  1. In GitHub Settings, Developer settings, GitHub Apps create a new GitHub App. The webhook URL can be left empty.
  2. Repository permissions: Contents read & write, Issues read & write, Pull requests read & write, Metadata read.
  3. Generate a private key (a .pem file) and note the App ID.
  4. Install the app on the account or organization and choose repositories. The Installation ID is in the URL after installation, for example https://github.com/settings/installations/12345678.

Option B, personal access token (legacy): create a classic token in GitHub token settings with repo (private repositories), public_repo (public repositories) and read:org (organization access) as needed.

Step 3: Store the tokens as secrets and create the instance

Create one service secret per token with create-service-secret on serviceId mpociot-claude-code-slack-bot (for example slackbot, slackapp, slacksecret, anthropickey). Then call create-service-instance with serviceId: "mpociot-claude-code-slack-bot":

{
  "name": "claudebot",
  "SlackBotToken": "{{secrets.slackbot}}",
  "SlackAppToken": "{{secrets.slackapp}}",
  "SlackSigningSecret": "{{secrets.slacksecret}}",
  "AnthropicApiKey": "{{secrets.anthropickey}}"
}

Add the GitHub options (GithubAppId, GithubPrivateKey, GithubInstallationId, or GithubToken) if you want repository access. Wait for the instance to be running (wait-for-service-ready) and check get-logs-for-instance if the bot does not respond.

Options

Option Required Type Meaning
name Yes string Name of the instance. Alphanumeric, at most 20 characters.
SlackBotToken Yes string, sensitive Slack Bot User OAuth Token, under OAuth & Permissions after installing the app; format xoxb-.... Sets SLACK_BOT_TOKEN.
SlackAppToken Yes string, sensitive Slack App-Level Token with the connections:write scope, generated under Basic Information, App-Level Tokens, used for Socket Mode; format xapp-.... Sets SLACK_APP_TOKEN.
SlackSigningSecret Yes string, sensitive Signing Secret of the Slack app, under Basic Information. Sets SLACK_SIGNING_SECRET.
AnthropicApiKey Yes string, sensitive Anthropic API key used by Claude Code to answer requests; format sk-ant-.... Sets ANTHROPIC_API_KEY. Upstream it is only needed if you do not use a Claude subscription or Bedrock/Vertex.
GithubAppId No string Numeric ID of the GitHub App the bot uses to access GitHub (recommended over a personal token). Sets GITHUB_APP_ID; used together with the private key and installation ID.
GithubPrivateKey No string, sensitive PEM private key of the GitHub App. The upstream .env example gives it as one quoted line with literal \n line breaks (-----BEGIN RSA PRIVATE KEY-----...). Sets GITHUB_PRIVATE_KEY.
GithubInstallationId No string Numeric installation ID of the GitHub App on the account or organization whose repositories the bot should access. Sets GITHUB_INSTALLATION_ID; the bot logs available installation IDs if it is not set.
GithubToken No string, sensitive GitHub personal access token (format ghp_...) for Git CLI and GitHub access, a legacy fallback when no GitHub App is configured. Sets GITHUB_TOKEN.

All sensitive options should be service secrets passed as {{secrets.NAME}} as the whole field value. Changing a secret later does not restart a running instance.

Using the instance

Invite the bot to a channel with /invite @your-bot-name, or send it a direct message. Start a thread to verify context is kept across messages. Examples:

@claude-code-bot Can you help me write a Python function to reverse a string?
@claude-code-bot Please review this JavaScript code: ...
@claude-code-bot I'm getting a "Cannot read property 'length' of undefined" error. Here's my code...

Troubleshooting:

  • Bot not responding: check that all tokens are correct, the bot is invited to the channel and the instance is running.
  • Permission errors: check the bot scopes in the Slack app settings and that the app is installed to the workspace.
  • GitHub authentication problems: verify the App ID, Installation ID and private key, or the token scopes.

Limitations

  • Review code shared with the bot for sensitive information.
  • Restrict the bot to the channels that need it and rotate tokens regularly.

Resources