> ## Documentation Index
> Fetch the complete documentation index at: https://open.ag2.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Connect Sutando to a Slack workspace so it can DM you, reply to @mentions in channels, and exchange files.

Sutando's Slack bridge uses **Socket Mode**, so Slack delivers events over a WebSocket and you need no public webhook. Plan on about 15 minutes; most of it is Slack's app configuration.

> [!TIP]
>
> Slack's app config page has several toggles that must all be right. You can ask Sutando to guide you hands-free: start a voice session, share your screen and say "help me set up Slack".

## Before you start

* A Slack workspace you are a member of, with permission to install an app (strict workspaces may need an admin to approve).
* AG2 Space installed and signed in on your Mac ([desktop.ag2.space](https://desktop.ag2.space)).

## Fast path: create the app from a manifest

At [api.slack.com/apps](https://api.slack.com/apps) click **Create New App → From a manifest**, pick your workspace, paste this and click **Create**. It sets Socket Mode, the bot scopes, the DM and @mention events and the Messages tab in one step.

```yaml app manifest theme={null}
display_information:
  name: Sutando
features:
  bot_user:
    display_name: Sutando
    always_online: true
  app_home:
    home_tab_enabled: false
    messages_tab_enabled: true
    messages_tab_read_only_enabled: false
oauth_config:
  scopes:
    bot:
      - app_mentions:read
      - channels:history
      - chat:write
      - files:read
      - files:write
      - groups:history
      - im:history
      - im:write
      - users:read
settings:
  event_subscriptions:
    bot_events:
      - app_mention
      - message.im
  socket_mode_enabled: true
```

A manifest cannot mint tokens, so finish with step 2 (App-Level Token), step 6 (install) and steps 7 to 9 below; skip steps 1, 3, 4 and 5.

## Step by step

**1. Create the Slack app**

At [api.slack.com/apps](https://api.slack.com/apps) click **Create New App → From scratch**, name it (for example `ada-sutando`), pick the workspace and click **Create App**.

**2. Enable Socket Mode and generate the App-Level Token**

Sidebar → **Socket Mode** → **Enable Socket Mode**. Generate an App-Level Token with the scope `connections:write` and copy the `xapp-` token.

> [!WARNING]
>
> Pick `connections:write`, not `app_configurations:write` near the top of the picker. With the wrong scope Sutando refuses to start with a missing-scope error.

**3. Add bot token scopes**

Sidebar → **OAuth & Permissions** → **Bot Token Scopes** (leave User Token Scopes empty). Add:

```text theme={null}
chat:write
im:history
im:write
app_mentions:read
channels:history
groups:history
files:read
files:write
users:read
```

`im:history` and `chat:write` are what DMs need; the `files:*` scopes let the agent exchange images and documents. If the agent will post into channels by name (for example delivering lead batches in the [GTM use case](https://open.ag2.space/use-cases/gtm.md#two-modes)), also add `channels:read` and `groups:read`.

**4. Enable Event Subscriptions**

Sidebar → **Event Subscriptions** → **Enable Events**. Leave the Request URL blank (Socket Mode replaces it). Under **Subscribe to bot events** add `message.im` and `app_mention`, then **Save Changes**.

If Save Changes is greyed out, hard-refresh the page (⌘⇧R). If it still is, type any placeholder URL; Socket Mode overrides it after saving.

**5. Enable the Messages tab**

Sidebar → **App Home** → **Show Tabs → Messages Tab**, and check **Allow users to send Slash commands and messages from the messages tab**. Without it the bot's DM shows "Sending messages to this app has been turned off".

**6. Install the app**

Sidebar → **Install App** → **Install to Workspace**, approve, and copy the **Bot User OAuth Token** (`xoxb-`).

> [!WARNING]
>
> Keep both tokens private. Together the `xoxb-` and `xapp-` tokens give full access to your bot.

**7. Paste both tokens into AG2 Space**

**Settings → Channels**: paste the `xoxb-` token into **Slack Bot Token** and the `xapp-` token into **Slack App-Level Token**, then click **Save** at the bottom. Without Save the old values stay in use and the bot stays offline. Both are stored locally on your Mac.

**8. Check the bridge from AG2 Space**

In your DM with the agent, send:

```text theme={null}
I added my Slack tokens. Please check the Slack bridge and make sure Slack is working.
```

It checks whether the bridge is installed, brings up what is missing, and tells you plainly whether Slack is connected.

**9. Enrol yourself from Slack**

DM the bot in Slack. It asks for a **pairing code**, which proves the person in Slack is you. Get it by asking your agent in AG2 Space ("Give me the Slack pairing code so I can paste it into Slack"), or read it from [the agent terminal](https://open.ag2.space/sutando/terminal.md). Paste it into the Slack DM to enrol as the bot's owner.

Anyone else who DMs the bot afterwards is silently rejected until you add them to the allowlist. Invite the bot to channels with `/invite @yourbot` and @mention it there.

## Troubleshooting

> [accordion] The bot never replies, even after a DM
>
> Check that **Enable Events** is on under Event Subscriptions. Then check for the "Workspace needs to reinstall app" banner on the OAuth page: new scopes take effect only after you reinstall.

> [accordion] "Sending messages to this app has been turned off"
>
> The Messages tab is off. App Home → Show Tabs → Messages Tab → check **Allow users to send Slash commands and messages from the messages tab**.

> [accordion] "missing\_scope" in the Sutando logs
>
> The App-Level Token has the wrong scope. Basic Information → App-Level Tokens: delete it, generate a new one with `connections:write`, paste the new `xapp-` token, Save.

> [accordion] Replies in DM but not to channel @mentions
>
> Check that `app_mention` is subscribed, and that the bot is a member of the channel. Bots cannot auto-join private channels; use `/invite` from inside the channel.

> [accordion] A teammate DMs the bot and gets no reply
>
> By design: the first enrolment makes one owner and later senders are dropped at the access gate. Add their Slack member ID under **Settings → Channels → Slack → Allowed senders**. See [Access Control Model](https://open.ag2.space/concepts/access-control-model.md) for what admitted senders may do.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.