Source connectors

Slack

Set up the Slack app that your deployment owns, for OAuth, the Events API, and intent-based thread capture.

Overview

Self-hosted Slack uses the same connector flow as hosted ctxpipe. But your deployment owns one Slack app. Organizations authorize that app into their workspace. They do not create their own Slack apps or webhook URLs.

This page covers only the operator setup. It has the Slack app, its scopes and events, and the secrets. For how people capture threads, see the Slack connector guide.

What you need

  • A public HTTPS AUTH_BASE_URL that Slack can reach.
  • A Slack app with OAuth and Event Subscriptions enabled.
  • A GitHub connection, and a Workspace that the GitHub App can write to.
  • Backend environment variables: SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_SIGNING_SECRET.
  • Model environment variables (MODEL_PROVIDER* / Bedrock), so the mention agent can read extra text after @mention. A bare mention captures without the model.
  • The same stable AUTH_SECRET and, when set, CONNECTION_SECRETS_ENCRYPTION_KEY on backend and worker so the worker can decrypt stored bot tokens.

1. Create the Slack app

In the Slack API dashboard, create an app. You can start from scratch. For higher rate limits in production, distribute it as a Marketplace app or an internal organization app. Do not use a throwaway development app.

If organizations will install the app into workspaces other than the app owner's development workspace, activate Manage Distribution in Slack. Marketplace listing is a separate step. Private distribution to many workspaces does not need it.

OAuth & Permissions

Add at least these bot token scopes:

  • app_mentions:read (receive capture requests from bot mentions)
  • channels:history, channels:read
  • groups:history, groups:read (private channels; invite the bot)
  • chat:write (in-thread capturing → captured status replies)
  • files:read
  • users:read

If you add a scope after a workspace installs the app, that workspace must complete OAuth again. A change to the Slack app settings does not upgrade the bot token that you have.

Register this OAuth redirect URL:

{AUTH_BASE_URL}/api/v1/connectors/slack/oauth/callback

Set SLACK_CLIENT_ID and SLACK_CLIENT_SECRET on the backend from the app credentials. Set SLACK_REDIRECT_URI only when the public callback differs from the URL derived from AUTH_BASE_URL.

Event Subscriptions

Enable Event Subscriptions and set the Request URL to:

{AUTH_BASE_URL}/api/v1/webhook/slack

Slack verifies the URL with a signed url_verification challenge. ctxpipe checks X-Slack-Signature using SLACK_SIGNING_SECRET.

Subscribe the bot to:

  • app_mention: the capture requests;
  • app_uninstalled and tokens_revoked: ctxpipe marks the connection revoked when a workspace removes the app.

Do not subscribe to message.channels / message.groups for the connector ingest path. Continuous message fan-out is not used.

Turn Socket Mode off. If Socket Mode is enabled, Slack does not POST to the Request URL (“You won’t need a Request URL”) and mentions never reach ctxpipe.

The Events URL is deployment-wide. Do not ask each organization to register its own webhook.

2. Wire deployment secrets

Set all three Slack values together. A partial configuration leaves OAuth or event verification unusable.

Docker Compose

Add the values to the root .env used by the deploy profile, then recreate the backend and the worker:

SLACK_CLIENT_ID=...
SLACK_CLIENT_SECRET=...
SLACK_SIGNING_SECRET=...
docker compose --profile deploy up -d --force-recreate backend worker

Terraform (Railway)

Store SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, and SLACK_SIGNING_SECRET in the secret store of your CI. The deploy writes them to the Railway services with scripts/railway-sync-variables.mjs. See Terraform.

AWS CDK

Pass Slack credentials through connectorSecrets:

new CtxPipe(stack, "CtxPipe", {
  // ...required props
  connectorSecrets: {
    slackClientId: cdk.SecretValue.secretsManager("slack-client-id"),
    slackClientSecret: cdk.SecretValue.secretsManager("slack-client-secret"),
    slackSigningSecret: cdk.SecretValue.secretsManager("slack-signing-secret"),
  },
})

Use your normal secret-management convention. Do not put plaintext credentials in source control.

3. Check the connector

After the Slack app is configured, an organization admin connects Slack on Connectors, adds the channels to a Workspace, and merges the source pull request. See the Slack connector guide.

  • One Slack workspace connects to one ctxpipe organization.
  • When you reinstall or rotate the Slack app, the bot leaves its channels. Invite it again in each channel.
  • All organizations of the deployment share the rate limits of the one Slack app.

Operator troubleshooting

“Slack is not configured on this deployment”

The backend does not have both OAuth values. Confirm that SLACK_CLIENT_ID and SLACK_CLIENT_SECRET are not empty in the backend runtime. Then redeploy or restart the backend. A change to repository secrets or CI secrets alone does not update a running service.

OAuth returns invalid_redirect_uri

Register the exact callback:

{AUTH_BASE_URL}/api/v1/connectors/slack/oauth/callback

Set SLACK_REDIRECT_URI only when you use a different public callback on purpose. Its value must exactly match a redirect URL registered in Slack.

Slack cannot verify the Events Request URL

  • Confirm the public route is {AUTH_BASE_URL}/api/v1/webhook/slack.
  • Confirm SLACK_SIGNING_SECRET is Slack's Signing Secret, not the legacy verification token.
  • Confirm the public proxy forwards the raw request body and X-Slack-Signature / X-Slack-Request-Timestamp headers unchanged.
  • An unsigned test POST must return 401. A 404 means that the routing is wrong. A 503 means that the backend has no signing secret.

Mentions do not create commits

  • Confirm Socket Mode is off and the bot Event Subscription includes app_mention.
  • Confirm that a Slack source with the status Connected lists the channel. If no Workspace has the channel, the bot replies "Nothing captured: no Workspace has this channel."
  • Confirm the bot is a member of the channel. After an app reinstall, invite it again.
  • Mention the bot's @handle (Slack autocomplete), not only a display name typed as plain text.
  • Read the worker logs for the Slack mention capture job. The backend and the worker must use the same database and stable encryption material (AUTH_SECRET and, when set, CONNECTION_SECRETS_ENCRYPTION_KEY). The GitHub App must still have contents write access to the Workspace repository. Extra text after a mention needs MODEL_PROVIDER* (or Bedrock). A second organization cannot install a workspace through OAuth when that workspace is already connected.

Capture commits but the repository never indexes

Capture writes to git through the GitHub App. Indexing starts only when this deployment receives the GitHub push webhook for that repository. Confirm that the GitHub App webhook URL points at this origin ({AUTH_BASE_URL}/api/v1/webhook/github/...) and not at another environment. Confirm that the worker and codesearch services run.