Skip to main content

How to trigger Claude Code from Slack

Summary

  • Three routes exist: Claude Tag for organizations on Team and Enterprise plans (Public Beta), the earlier Claude Code in Slack integration for individual accounts, and a custom Slack app that runs Claude Code on your own infrastructure.
  • With Claude Tag or the earlier integration you @mention Claude in a channel and the session runs on Anthropic's service, so there is no code to write.
  • A custom Slack app should verify Slack's request signature and must acknowledge each request within 3 seconds, then post the result later, because a Claude Code run takes longer than Slack will wait.
  • Run Claude Code non-interactively with claude -p, limit it with --allowedTools, and route its model traffic through Unity Gateway to get Unity Catalog permissions, rate limits, budgets, and usage tracking.
  • Treat Slack messages as untrusted input: Claude can follow instructions found in the conversation context, so trigger it only from trusted conversations.

How to trigger Claude Code from Slack

There are three ways to trigger Claude Code from Slack. Organizations on Anthropic's Team and Enterprise plans use Claude Tag, which is in Public Beta and brings Claude into shared channels for work such as fixing bugs. Individual accounts use the earlier Claude Code in Slack integration. Teams that need sessions to run on their own infrastructure build a Slack app that starts Claude Code from a backend. The first two need no code. The third gives you control, and it is where Databricks Unity Gateway applies.

Which approach fits your team?

Approach Requirements Where the work runs How you trigger it
Claude Tag (Public Beta) A Team or Enterprise plan; an Owner pairs the Slack workspace An ephemeral sandbox on Anthropic's service Tag @Claude in a channel, thread, or DM
Earlier Claude Code in Slack An individual Claude plan (Pro or Max), a GitHub repository, and a workspace that is not connected to Claude Tag A Claude Code cloud session under the user's own account @mention Claude in a channel
Custom Slack app A Slack app and a backend you host with Claude Code installed Your infrastructure An app_mention event, a slash command, or a message shortcut

How do you set up Claude Tag or the earlier integration?

For Claude Tag, an Owner opens claude.ai/admin-settings/claude-tag, sends @Claude connect in Slack to get a pairing code, enters the code, sets a monthly spend limit, adds Claude to channels, and launches. Channel work bills to the organization's usage balance, and Slack users do not each need a Claude seat.
For the earlier integration, a Slack workspace admin installs the Claude app from the Slack Marketplace. Each user connects their Claude account in the app's Home tab, connects GitHub at claude.ai/code with at least one repository, and invites Claude to a channel with /invite @Claude. It works in channels only, not direct messages, supports GitHub repositories only, and counts sessions against the user's plan limits.

How do you build your own trigger?

  1. Receive the event. Subscribe to app_mention events (scope app_mentions.read), or add a slash command or a message shortcut.
  2. Verify the request. Compute an HMAC SHA-256 of v0:<timestamp>:<body> with your signing secret, compare it with the X-Slack-Signature header, and reject timestamps that differ from your clock by more than five minutes.
  3. Acknowledge within 3 seconds. Slash commands, interaction payloads, and Events API deliveries all expect a fast HTTP 200 or 2xx. Slack retries a failed event delivery three times, so deduplicate by event_id and queue the work instead of doing it in the handler.
  4. Run Claude Code in the background. Use non-interactive mode, for example claude -p "<task>" --allowedTools "Read" --output-format json, or the Agent SDK for Python and TypeScript.
  5. Post the result. Reply with the chat.postMessage method (bot scope chat:write, thread_ts to reply in a thread). For slash commands and interactions, a response_url accepts up to 5 responses within 30 minutes.

How do you keep a custom trigger safe?

Treat Slack text as untrusted input. Anthropic's own Slack integration warns that Claude may follow directions found in other messages in the conversation context. Check the user and channel IDs in each event against an allowlist, and pre-approve only the tools a task needs with --allowedTools.
Route the model traffic through Unity Gateway. Databricks documents how to point Claude Code at a gateway with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, or with the ug claude launcher on a developer machine. Unity Catalog then controls who can call the model service (EXECUTE), rate limits can apply per user or service principal, budgets can alert or block, and the system.ai_gateway.usage table records requests. Inference tables, a billed feature, log request and response payloads for audit. Claude Tag and the earlier integration run on Anthropic's service and bill to Claude plan limits or an organization usage balance, so this section applies to the custom build.

FAQs

Can Claude open a pull request from Slack?

Yes. In the earlier integration, a Claude Code session shows a Create PR button, and each session can create one pull request. Claude Tag can turn a bug report in a channel into a draft pull request when GitHub is connected.

Does it work in direct messages?

Claude Tag does. A one-to-one DM from a member who connected a Claude account runs on that account. The earlier integration answers only in channels.

Do I need an API key for a custom build?

With --bare, Claude Code never reads OAuth credentials or the system keychain, so set ANTHROPIC_API_KEY from a Claude Console key or use a supported cloud provider's credentials. To route through Unity Gateway instead, follow the environment settings in the Databricks guide.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.