> ## Documentation Index
> Fetch the complete documentation index at: https://opensandbox-disk-resize.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Message an agent from Slack

Connect an [agent](/agent-sessions/agents) to Slack, then start and continue
[sessions](/agent-sessions/sessions) from direct messages or channel mentions.
OpenComputer records the same session and event history you see in the
dashboard.

## Connect the OpenComputer app

The quickest path uses the OpenComputer-operated Slack app. Creating an agent
opens guided setup; choose **Connect Slack**, approve the workspace
installation, and return to the same setup page. You can also connect or manage
Slack later from the agent overview.

Before sending you to Slack, the dashboard lists any workspace in your account
that already sends messages to another agent. You can open that agent, connect a
different workspace, or disconnect the workspace in place. The confirmation
names the affected agent and explains that new Slack messages stop routing to
it; the agent, existing sessions, and installed OpenComputer app remain. OAuth
still checks the claim again in case another tab connects the workspace after
this preflight.

You can connect Slack while a repository deployment is still running. The
connection remains in place if that deployment fails, but the app cannot run a
message until the agent has a ready deployment. A message sent too early gets a
short deploying response and is not queued. Setup follows deployment progress
without a manual refresh. Wait for it to show **Send your first message** and
**Open Slack**, then send the message again. While setup is unfinished, the
agent page keeps **Continue setup** visible. After Slack creates the first real
session, setup changes automatically from “waiting for a message” to a compact
conversation preview with links to the full session and the agent's session
history.

For Flue agents, setup may also offer working-repository access and a concrete
first task such as opening a pull request. GitHub access is optional: Slack chat
continues to work when repository access is empty or disconnected.

<Warning>
  Anyone in the connected Slack workspace who can message the app can use this
  agent. Use the shared app for evaluation with an agent whose tools and spend
  are appropriately bounded.
</Warning>

<Note>
  A workspace can connect the managed app to one agent at a time. Managed Slack
  accepts text direct messages and mentions in ordinary workspace channels.
  Files and Slack Connect DMs or mentions are not supported yet.
</Note>

The same flow is available over the API:

<CodeGroup>
  ```ts TypeScript SDK theme={null}
  const authorization = await oc.agents.authorizeManagedSlack(agentId, {
    returnDeploymentId: deploymentId, // optional validated return context
  });

  if ("authorizeUrl" in authorization) {
    // Return this from your authenticated server route, then navigate the user's
    // browser to it. Never expose the OpenComputer org key to the browser.
    return authorization.authorizeUrl;
  }
  // Otherwise the agent was already connected; `authorization` is its current
  // public connection state.

  const connection = await oc.agents.getManagedSlack(agentId);
  // { mode: "managed", status: "active", workspace, app, openUrl, ... }

  const { data: workspaceClaims } = await oc.agents.listManagedSlackConnections();
  // [{ workspace, app, agent: { id, name }, status, ... }]

  await oc.agents.disconnectManagedSlack(agentId);
  ```

  ```http REST API theme={null}
  POST   https://api.opencomputer.dev/v3/agents/{agent_id}/slack/managed/authorize
  GET    https://api.opencomputer.dev/v3/agents/{agent_id}/slack/managed
  DELETE https://api.opencomputer.dev/v3/agents/{agent_id}/slack/managed
  GET    https://api.opencomputer.dev/v3/slack/managed/connections
  Authorization: Bearer $OPENCOMPUTER_API_KEY

  // optional authorize body
  { "return_deployment_id": "dep_..." }
  ```
</CodeGroup>

Disconnecting an agent stops its managed Slack routing. It does not uninstall
the shared app from the workspace or remove existing OpenComputer sessions.

## Conversations and sessions

A new root direct message creates a session. Replies in its Slack thread steer
the same session; another root message creates a new one. In a channel, invite
`@OpenComputer` and mention it to start or continue a thread. The app does not
read unmentioned channel messages.

Slack deliveries are signature-verified and deduplicated before they enter the
session. A transient **Working…** status may appear for a direct message or
mention. The final assistant response is posted to the same thread, while
diagnostics and the full event history remain in OpenComputer.

## Use your own Slack app

For a permanent bot identity, connect an app you operate. On the agent page,
choose **Use your own Slack app**, copy the generated manifest into Slack, then
enter the App ID, Signing Secret, and Bot User OAuth Token. Credentials are
write-only and are never returned by the API.

<CodeGroup>
  ```ts TypeScript SDK theme={null}
  const { manifest, createUrl } = await oc.agents.slackManifest(agentId);

  const slack = await oc.agents.connectSlack(agentId, {
    appId: "A0…",
    signingSecret: "…",
    botToken: "xoxb-…",
  });

  await oc.agents.getSlack(agentId); // public status only
  await oc.agents.disconnectSlack(agentId); // purge credentials and stop routing
  ```

  ```http REST API theme={null}
  POST   https://api.opencomputer.dev/v3/agents/{agent_id}/slack/manifest
  POST   https://api.opencomputer.dev/v3/agents/{agent_id}/slack
  GET    https://api.opencomputer.dev/v3/agents/{agent_id}/slack
  DELETE https://api.opencomputer.dev/v3/agents/{agent_id}/slack
  Authorization: Bearer $OPENCOMPUTER_API_KEY

  // finalize body
  { "app_id": "A0…", "signing_secret": "…", "bot_token": "xoxb-…" }
  ```
</CodeGroup>

The managed and builder-owned apps may overlap while you test the handoff. They
keep separate conversations and sessions. Once your app is working, disconnect
the OpenComputer app explicitly.

## Delivery behavior

* A duplicate Slack event creates at most one agent turn.
* Direct-message thread replies continue their existing session.
* Channel replies require another mention.
* The OpenComputer app replies to a message containing a file with a text-only
  notice; resend the content as a text message.
* Responses longer than Slack's message limit include a link to the full
  authenticated session in OpenComputer.
* Slack delivery can retry independently of agent execution, so a provider
  timeout may rarely produce a duplicate Slack post rather than lose the only
  answer.
