# Slack connector (https://docs.ctxpipe.ai/docs/connections/source-connectors/slack)

The **Slack connector** keeps the Slack threads that matter, such as decisions,
incidents, and design debates, in a [Workspace](/docs/workspaces). It does not
mirror channels or read Slack in the background. A person mentions the bot in
a thread, and ctxpipe saves that thread as Markdown.

The pull request that adds the channels to a Workspace is the reviewed part.
Each capture after that is a commit, so git history records who captured which
thread, and when.

A Slack workspace can connect to one ctxpipe organization. On a self-hosted
deployment, the operator creates the Slack app first. See
[Self-host Slack](/docs/self-hosting/slack).

## Slack connector or Slack MCP

| Tool                                                               | Use it to                                               |
| ------------------------------------------------------------------ | ------------------------------------------------------- |
| **ctxpipe Slack connector** (this page)                            | Keep chosen threads in git, where ctxpipe indexes them. |
| **[Slack MCP server](https://docs.slack.dev/ai/slack-mcp-server)** | Search and read live Slack from your coding agent.      |

The two do different jobs. You can use both.

## Connect Slack

Follow [Add a tool to a Workspace](/docs/connections#add-a-tool-to-a-workspace).
For Slack:

1. On **Connectors**, select **Add connection**, then select **Connect** on the
   **Slack** row. Authorize the Slack workspace.
2. In **Add to Workspaces**, select the Workspaces, then the channels for each
   one. When captures can include private channels, use a separate Workspace
   with a private repository.
3. Merge the pull request that adds `sources/slack/<name>.md`. Captures start
   after the merge.

## Capture a thread

1. Invite the bot to the channel with `/invite`. The connector card shows the
   **@handle** of the bot.
2. In the thread, mention the bot:

   ```text
   @your-bot-handle capture this
   ```

   A mention with no other text also captures. A mention outside a thread does
   not capture.

ctxpipe replies in the thread with **ctxpipe agent working…**, then changes the
reply to **Engineering context captured into**, with a link to the file in each
Workspace that has the channel. ctxpipe does not answer other questions in
Slack. It replies with what it can do.

Later replies in the thread are not captured by themselves. Mention the bot
again to capture the thread again. The new capture replaces the file.

## What is captured

ctxpipe saves the thread in each Workspace whose **Connected** Slack source has the
channel, with one commit for each Workspace:

* the file is
  `slack/channels/<channelId>/threads/<yyyy>/<mm>/<threadTs>/thread.md`;
* the front matter holds the capture time, the Slack link, the channel and
  thread ids, and the handle and name of the person who captured it;
* the authors and the people mentioned show by name;
* files and embedded media are copied into the `assets/` folder of the thread.
  Each asset can be up to 25 MiB, and each thread up to 100 MiB in total;
* a thread longer than 500 messages keeps its oldest 500, and the reply in Slack
  says so.

Not included: channel mirrors, history backfill, direct messages, and automatic
updates after a capture. When you uninstall Slack, or remove a channel from a
source, the captured threads stay in the repository.

## Troubleshooting

* **A mention does nothing.** Check that the connector shows **Connected**,
  that a **Connected** source has the channel, and that the bot is in the channel.
  Use Slack autocomplete to mention the bot. If no Workspace has the channel,
  the bot replies "Nothing captured: no Workspace has this channel."
* **A private channel does not work.** Invite the bot to the channel first.
* **The source is OK, but the bot is not in the channel.** The reason on the
  row tells you to invite the bot.

For other problems, see [Troubleshooting](/docs/connections#troubleshooting).
