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

# Connect an agent to Slack

> Create a Slack app, connect it to an AskTable agent, and let your team ask data questions in channels or direct messages.

Connect an AskTable agent to Slack so your team can ask data questions where they already work. People can mention the bot in a channel or message it directly, and the answer returns to Slack.

AskTable connects through Slack's **Socket Mode**. You do not need to expose a public callback URL.

## Before you start

You need:

* Permission to create and install an app in your Slack workspace. If your organization restricts app installation, ask a Slack workspace administrator to approve it.
* An AskTable agent with its data sources and skills already configured.

<Note>
  One AskTable project can connect to one Slack workspace.
</Note>

## 1. Create the Slack app

Open [Slack apps](https://api.slack.com/apps), select **Create New App**, then choose **From an app manifest**. Select your workspace and paste this YAML manifest:

```yaml theme={null}
_metadata:
  major_version: 1
display_information:
  name: AskTable
  description: Ask questions about your data in natural language
features:
  bot_user:
    display_name: AskTable
    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
      - im:history
      - chat:write
      - reactions:write
      - users:read
      - users:read.email
settings:
  event_subscriptions:
    bot_events:
      - app_mention
      - message.im
  socket_mode_enabled: true
  org_deploy_enabled: false
  token_rotation_enabled: false
```

Review the settings, then select **Create**. You can change the app name and bot display name before creating the app.

The requested permissions let the bot:

| Purpose           | Permissions                                       |
| ----------------- | ------------------------------------------------- |
| Receive questions | Messages that mention the bot and direct messages |
| Send answers      | Messages and a short acknowledgment reaction      |
| Identify users    | Name, avatar, and email for access control        |

<Warning>
  Keep `messages_tab_enabled: true`. Without it, people cannot send direct messages to the bot.
</Warning>

The manifest does not request `channels:history` or `groups:history`. AskTable cannot read unrelated channel conversations; as a result, every channel question must mention the bot.

## 2. Get the two tokens

First, open **OAuth & Permissions** and select **Install to Workspace**. Approve the requested permissions, then copy the **Bot User OAuth Token**. It starts with `xoxb-`.

Next, open **Basic Information → App-Level Tokens**:

1. Select **Generate Token and Scopes**.
2. Enter a name for the token.
3. Add the `connections:write` scope.
4. Generate and copy the token. It starts with `xapp-`.

| AskTable field | Slack token          | Prefix  |
| -------------- | -------------------- | ------- |
| **Bot Token**  | Bot User OAuth Token | `xoxb-` |
| **App Token**  | App-Level Token      | `xapp-` |

The Bot Token lets AskTable receive user details and send replies. The App Token opens the Socket Mode connection. You do not need a Signing Secret.

<Warning>
  Treat both tokens as passwords. Do not include them in screenshots, support tickets, or chat messages. If a token is exposed, revoke it in Slack and update AskTable with the replacement.
</Warning>

## 3. Connect Slack in AskTable

Open the agent you want to connect, then select the **Channel** tab:

1. Under **Platform**, select **Slack**.
2. Enter the `xoxb-` token in **Bot Token**.
3. Enter the `xapp-` token in **App Token**.
4. Select **Save**.

AskTable checks both token prefixes before saving. After a successful save, Slack becomes the active platform for this agent.

You can also adjust these settings:

| Setting                 | Default | What it does                                                           |
| ----------------------- | ------- | ---------------------------------------------------------------------- |
| **Reply in thread**     | On      | Opens a thread for each channel question and keeps follow-ups together |
| **Deep reasoning**      | Off     | Gives the model more time for complex questions                        |
| **Channel preferences** | Empty   | Adds standing instructions, such as "Lead with the conclusion"         |

## 4. Check the connection

The Channel card shows the current connection status:

| Status           | Meaning                                                       |
| ---------------- | ------------------------------------------------------------- |
| **Connected**    | The tokens are valid and the Socket Mode connection is active |
| **Connecting**   | AskTable is connecting or reconnecting                        |
| **Disconnected** | No active connection is available                             |
| **Error**        | Slack rejected the connection or a connection error occurred  |

The status refreshes automatically every five seconds. **Refresh** only reloads the status; the Slack connection reconnects automatically when needed.

<Note>
  **Connected** confirms the Slack connection only. After sending a test question, check **Latest message** to confirm that AskTable received, processed, and replied to it.
</Note>

## 5. Add the bot to a channel

The bot must be a member of a channel before it can receive mentions there. In the target channel, enter:

```text theme={null}
/invite @AskTable
```

You can also open the channel settings and select **Integrations → Add apps**. Direct messages do not require an invitation.

## 6. Ask questions

| Where            | What to send                             |
| ---------------- | ---------------------------------------- |
| Direct message   | `What was revenue last month?`           |
| Channel          | `@AskTable What was revenue last month?` |
| Thread follow-up | `@AskTable Break it down by region.`     |

In channels, mention the bot in every question, including follow-ups inside a thread. AskTable deliberately avoids permissions that would let it read the full channel history.

A thread belongs to the person who started it. If someone else mentions the bot in that thread, AskTable asks them to start a new question in the channel. Multi-person direct messages are not supported.

<Warning>
  Answers posted in a channel are visible to everyone in that channel. Use a direct message when the result should remain private.
</Warning>

## Troubleshooting

| Problem                     | What to check                                                                                                                                                                                                  |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Connection shows Error**  | Confirm that the Bot Token starts with `xoxb-`, the App Token starts with `xapp-`, Socket Mode is enabled, and the App Token has `connections:write`. Also confirm that the app is installed in the workspace. |
| **Latest message is empty** | Confirm that the bot is in the channel, the message mentions the bot, and the app subscribes to `app_mention` and `message.im`. For direct messages, confirm that the app's Messages tab is enabled.           |
| **Processing failed**       | Open **Details** under Latest message. Check that the agent has working data sources and the user has access to it, then try the question again.                                                               |
| **Reply failed**            | Confirm that the bot is still in the channel and has `chat:write`. If you changed Slack permissions, reinstall the app to the workspace before trying again.                                                   |

## Next steps

* [Connect data](/en/concepts/data/connect)
* [Understand channels and access control](/en/concepts/agent/channel)
* [Add table and field notes](/en/concepts/data/annotations)
