---
title: "Slack"
description: "Mention @cloudraker in Slack and an agent of your front door answers in the thread."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

The **CloudRaker Run** Slack app adds one bot, `@cloudraker`, to your Slack workspace. A person mentions `@cloudraker` in a channel or writes to it in a DM. The platform finds the [front door](https://docs.cloudraker.com/run/guides/front-doors) of the workspace or of the channel, and opens a [conversation](https://docs.cloudraker.com/run/guides/conversations). The agent replies in the same thread. Later messages in that thread go to the same conversation.

## How it works

1. Slack sends the message to the platform. The platform checks the signature and the workspace.
2. The platform finds the door. A binding of the channel wins over the binding of the workspace. With no binding, the bot does not answer.
3. `channels.slack.access` of the door decides if this user may use `@cloudraker` here.
4. A thread that already has a conversation continues it.
5. Else a new conversation starts. The door router picks the first agent: the rules, then the classifier on the `when` texts, else the entry agent.
6. The input checks of the door run on the message. A refused message gets a notice and never reaches a model.
7. The agent run starts. Its replies stream into the thread. An agent can hand the conversation to another agent of the door.

## Install the app

You need the `admin` role in the console.

1. Open the **Slack** screen in the console (`https://run.cloudraker.com/slack`).
2. Click **Connect Slack**. Slack shows the consent screen.
3. Approve the install. Slack sends you back to the console.
4. Bind the workspace to a door (next section).

| Case                                  | Result                                                                                                     |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| You cancel on the consent screen      | The console shows "Install cancelled".                                                                     |
| The workspace needs Slack admin approval | Slack sends the request to a Slack admin. Run the install again after the approval.                      |
| Another org holds the workspace       | The install fails with `slack_team_taken`.                                                                 |
| Your org already holds a workspace    | The install fails with `slack_org_has_workspace`. One org has one workspace, and one workspace has one org. |
| Enterprise Grid org-wide install      | The install fails with `slack_enterprise_install`. A workspace install inside a Grid org works.            |

**Disconnect** on the Slack screen revokes the bot token and removes the workspace. An uninstall from Slack does the same. Live runs finish, but their Slack replies drop.

The bot joins a channel only when you invite it: `/invite @cloudraker`. It never joins a channel by itself.

## Bind the workspace to a door

Add `channels.slack` to a door and push:

```yaml doors/assistant.yml
name: Company assistant
entry: general
agents:
  - agent: invoice-processing
    when: Someone shares an invoice or a bill and wants it entered or checked.
  - agent: it-help
    when: Laptops, accounts, passwords and access requests.
router:
  rules:
    - keywords: [invoice, facture, bill]
      agent: invoice-processing
channels:
  slack:
    follow_ups: true
    history_limit: 20
```

Then bind the workspace on the **Channels** page, or with the CLI:

```bash
rakerun channel bind slack T0123ABCD --door company/assistant                  # the whole workspace
rakerun channel bind slack T0123ABCD/C0456EFGH --door finance/invoices     # one channel wins
```

- The workspace binding is the default door. A channel binding wins in that channel.
- Doors of several repos can share one workspace, one door per channel.
- Only the live deployment of the default branch answers. Previews have no doors.
- A binding to a door that is gone, or that has no `channels.slack`, answers nothing. The **Channels** page shows it in red.

A Slack conversation skips `protection` and the `triggers.http` gate of the agents. The door is the access check.

## Threads

One Slack thread is one conversation. The person who starts the thread is the participant of the conversation.

| Event in the thread                     | Result                                                                              |
| --------------------------------------- | ----------------------------------------------------------------------------------- |
| First message                           | A new conversation. The router picks the agent.                                     |
| Reply of the participant                | The next turn of the conversation.                                                  |
| Reply of another user                   | An ephemeral notice to that user. The message does not go to the agent.             |
| Reply while the agent works             | One message is in flight at a time. The reply does not go to the agent. Send it again after the answer. |
| Reply after the run ended or expired    | A new run of the same agent, with the transcript.                                    |
| Click on a `question` button            | The answer to the open question.                                                    |
| Stop button in Slack                    | Stops the current turn.                                                             |

Which replies of the participant reach the agent is `channels.slack.follow_ups`:

| Value            | Rule                                                 |
| ---------------- | ---------------------------------------------------- |
| `true` (default) | Every reply of the participant in the thread.        |
| `false`          | Only replies that mention `@cloudraker`.             |

Other rules:

- A top-level mention starts a new thread at the mention.
- In a DM, no mention is needed. Each DM thread is one conversation.
- Messages from other bots and apps never start a turn.
- Edits are ignored. To change a request, send a new message.
- A conversation that ended (idle time, `max_turns`, a cap, the kill switch) takes no more messages. The next message in the thread starts a new conversation.
- The door `session.idle_ttl` ends a quiet conversation.

### History

A new conversation reads the earlier thread messages, up to `channels.slack.history_limit` (default 20, max 100). A first mention inside an older thread reads that thread once from Slack. Slack limits this read for unlisted apps. When the read is not possible, the conversation starts with the triggering message only.

## Files

Files shared with a message of the participant become files of the conversation. Read [Files](https://docs.cloudraker.com/run/guides/files).

| Case                                         | Result                                                              |
| -------------------------------------------- | ------------------------------------------------------------------- |
| A file over 5 MB                             | The file is not sent. The message goes without it.                  |
| More than 25 MB of files in one conversation | The extra files are not sent.                                       |
| A door with `guards.input`                   | Files are refused unless the door sets `guards.files: allow`.       |
| A top-level file with no mention in a channel | Nothing happens.                                                   |

A `file` item of the agent becomes a file upload in the thread.

## Replies

The platform posts to Slack for the agent. The agent never gets the bot token, and it needs no `slack.com` host in `network`.

| Conversation item | In Slack                                                                                          |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| `message.delta`   | Text added to the reply stream as the model writes it.                                            |
| `message`         | The final text of the reply.                                                                      |
| `activity`        | A task row for each tool call of the agent.                                                       |
| `question`        | One button per choice (5 or fewer), else a select menu (up to 100). Free text in the thread also answers. |
| `file`            | A file upload in the thread.                                                                      |
| `handoff`         | A context line: `Now with {agent}`.                                                               |
| `blocked`         | A context post with the door message. The refused text is not kept.                               |
| `ended`           | A context post with the end message.                                                              |

### Streaming

The platform uses the Slack agent streaming API (`chat.startStream`, `chat.appendStream`, `chat.stopStream`). The model text streams as it is written. The platform sends at most 1 append per second per stream and batches the text between appends. A door with output checks streams only checked text: nothing before the whole reply passes (`hold: reply`), or one checked sentence at a time (`hold: sentence`).

When Slack refuses to open a stream, the platform posts the final text as normal messages.

### Output rules

- Write Slack markdown: short paragraphs, no tables, links as `<url|label>`.
- The platform removes `<!channel>`, `<!here>`, `<!everyone>` and user group pings from the output.
- Link previews are off. Slack never fetches a URL of the agent.

## Access

By default, full workspace members can use `@cloudraker` in any conversation that has the bot. Guests, Slack Connect users and shared channels are denied.

Change this with `channels.slack.access` in the door:

```yaml doors/assistant.yml
channels:
  slack:
    access:
      users: [U012ABCDEF, ana@example.com, '@finance']
      channels: [C04ABCD1234, im]
      external: false
      guests: false
```

- A `channels` list denies DMs unless it holds `im`.
- A denied mention gets the ephemeral reply "You cannot use @cloudraker here." A denied reply in a thread gets no answer.

### Data exposure

A reply in a channel is visible to every channel member. An agent that reads private data can show it there.

- `metadata.end_user` scopes Structured Memory records to the participant. Slack users are verified, so the value is stable for one user.
- Bind a door with sensitive agents only to listed channels, and set `access.channels`.
- An agent with `workspace_act_as` and `as.from: sender` acts as the participant.

### Retention

- The door `session.retention` (default 30 days) applies to the conversation and its runs, from the end of the conversation.
- Agent `webhooks:` can send Slack text to your own servers.
- No Slack data trains a model.

## Errors

| Case                                          | What the user sees                                                                                         |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| No binding for the workspace or the channel   | No reply.                                                                                                  |
| A message that an input check refuses         | A context post with the door message.                                                                      |
| A door limit is reached                       | The `messages.at_capacity` text of the door. The conversation ends.                                        |
| The kill switch is on                         | The `messages.maintenance` text of the door. The conversation ends.                                        |
| Out of credits                                | "This workspace is out of CloudRaker credits." Admins see a console banner.                                |
| Run failed                                    | A notice in the thread. The next message starts a new run with the transcript.                             |
| Bot removed from the channel, channel archived | No reply.                                                                                                 |
| App uninstalled or token revoked              | No reply. The console shows **Disconnected**.                                                              |
| Slack rate limit or Slack error 5xx           | The platform retries with a backoff. The user sees a delay.                                                |

## Limits and pricing

| Item                | Rule                                                                                                 |
| ------------------- | ---------------------------------------------------------------------------------------------------- |
| Billing             | Each run costs the same as any run. Router and guard calls are not billed in the beta.               |
| Concurrent runs     | The plan limit (default 5). A run waits up to 10 minutes for a slot.                                 |
| Message text        | 4,000 characters. A longer message is cut, with the line `[Message cut at 4000 characters.]`.        |
| Files               | 5 MB per file, 25 MB per conversation.                                                               |
| Door limits         | `limits` of the door: daily credits, daily conversations, and per user messages per minute and conversations per day. |

Slack conversations do not use the `60 run starts per minute` limit of the HTTP API. The door limits and the concurrency cap apply instead.

| Rate limit                    | Value                                     | Result                                                                    |
| ----------------------------- | ----------------------------------------- | ------------------------------------------------------------------------- |
| Slack events from Slack       | 30,000 per workspace per hour             | Slack sends `app_rate_limited` and drops events. The bot gets every message of its channels, so keep it out of very busy channels. |
| Stream appends                | 1 per second per stream                   | The platform batches the text.                                            |
| Posts                         | About 1 per second per channel (Slack)    | A `429` retries after `Retry-After`.                                      |

Read [Limits and pricing](https://docs.cloudraker.com/run/guides/limits-and-pricing).

## Not in v1

- Slash commands, shortcuts, modals and App Home content. Only the App Home **Messages** tab is on.
- Agents that call the Slack API directly.
- Agents that read every channel message without a mention.
- Several people in one conversation. Only the thread starter talks to the agent.
- Several workspaces per org, and Enterprise Grid org-wide installs.
- Custom bot names, per-agent Slack apps, and your own Slack app.

Source: https://docs.cloudraker.com/run/guides/slack/index.mdx
