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

# Integrate Slack with an agent

> Connect LangSmith Fleet to your Slack workspace to let your agents communicate with users in Slack.

With LangSmith Fleet, you can securely connect your agents to your Slack workspace to let your agents communicate with users in Slack.

After integrating, your agents will be able to:

* Receive messages directly from your Slack bot, starting a new run with the message content.
* Communicate back to your Slack workspace after processing the message.
* Obtain relevant context from Slack by reading thread messages and conversation history.

LangSmith Fleet offers two ways to connect an agent to Slack: a **custom Slack bot** (recommended) and the **default Slack bot**.

## Custom vs. default bot

|               | [Custom Slack bot](#set-up-a-custom-slack-bot)  | [Default Slack bot](#set-up-the-default-slack-bot)                |
| ------------- | ----------------------------------------------- | ----------------------------------------------------------------- |
| **Slack app** | Your own app, created through LangSmith         | LangSmith's Slack account                                         |
| **Trigger**   | Tag the bot directly with `@Bot_Name`           | Every message in the channel                                      |
| **DMs**       | ✅                                               | ❌                                                                 |
| **Best for**  | Direct back-and-forth communication from Slack. | Starting a run every time a message is sent in a specific channel |

<Info>
  The Slack integration with Fleet does not have any direct pricing. However, agent runs and traces are billed through the [LangSmith platform](https://smith.langchain.com?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=langsmith-fleet-slack-app) according to your organization's plan.

  For current pricing information, see the [LangSmith pricing page](https://www.langchain.com/pricing).
</Info>

## Set up a custom Slack bot

A custom Slack bot gives you full bidirectional communication between your agent and Slack.

### Prerequisites

* An existing agent in Fleet (see [Quickstart](/langsmith/fleet/quickstart) to create one)
* Admin access to a Slack workspace or permission to install apps

### Create the Slack app

<Steps>
  <Step title="Create a new Slack app">
    1. Navigate to the **Integrations** page in Fleet and go to the **Apps** section.
    2. Click **Add Slack App**.
    3. Enter a name for the bot.
    4. Click **Create Slack App**. You will be redirected to the Slack API site with a popup asking you to pick a workspace.

    <Warning>
      Do not create a separate Slack app outside of this flow. The app must be created through this popup.
    </Warning>
  </Step>

  <Step title="Select your workspace">
    1. Choose the workspace where you want to install the bot.
    2. Click **Next**.
    3. Click **Create Bot**.
  </Step>

  <Step title="Enter your app credentials">
    After creating the bot, you will receive your app credentials. Enter the following credentials in Fleet:

    * App ID
    * Client ID
    * Client secret
    * Signing secret

    <Note>
      Copy the full client secret and signing secret carefully to ensure a successful connection.
    </Note>
  </Step>

  <Step title="Connect OAuth">
    1. Click **Connect OAuth**.
    2. Click **Allow** to give Fleet access to your app.
  </Step>

  <Step title="Finish setup">
    Link your Slack bot to an existing agent, or click **Finish** to link later.
  </Step>
</Steps>

### Link the Slack bot to an agent

You can link a Slack bot to an agent from the integrations page or from the agent editor. Each agent can only have one Slack app, and each Slack app can only be linked to one agent.

<Tabs>
  <Tab title="From the Integrations page">
    1. Navigate to the **Slack Apps** section on the **Integrations** page in Fleet.
    2. Select the bot you want to link.
    3. From the dropdown menu, choose the agent you want to link to.
    4. Verify that **\<Agent Name>** appears next to the bot name.
  </Tab>

  <Tab title="From the agent editor">
    1. Select your agent from **My Agents** in the left-hand navigation.

    2. Click <Icon icon="pencil" /> **Edit Agent**.

    3. Scroll to the **Channels** section.

           <Note>
             You may need to set the agent identity first. Click **Set Identity** in the top right corner.
           </Note>

    4. Click **Slack**.

    5. From the dropdown menu, select the Slack app you want to link.
  </Tab>
</Tabs>

### Invite the bot to your channel

1. In Slack, go to the channel where you want to use the bot.
2. Type `/invite @YourSlackBotName` to invite the bot.
3. Send a message mentioning the bot to verify it responds.

### Configure agent behavior (optional)

Your agent needs to know how to handle incoming Slack messages. Update its instructions by prompting it directly in the agent chat:

```
Update your instructions to handle the Slack Trigger and Slack Tools
for bidirectional communication
```

Adjust the instructions based on your use case—for example, you might want the agent to only respond to certain types of questions, or to pull information from specific sources before replying.

## Set up the default Slack bot

The default Slack bot uses LangSmith's Slack account and triggers your agent on every message posted in a connected channel. It cannot receive DMs.

<Steps>
  <Step title="Authenticate with Slack and get the channel ID">
    1. On the [Fleet > Integrations page](https://smith.langchain.com/agents/tools), authenticate with Slack.
    2. In Slack, invite the default app (`@LangSmith Fleet`) to a channel.
    3. Copy the channel ID.
  </Step>

  <Step title="Open the agent editor">
    In [Fleet](https://smith.langchain.com/agents?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=langsmith-fleet-slack-app), select your agent and click the <Icon icon="pencil" /> **Edit Agent** icon.
  </Step>

  <Step title="Add a Slack channel">
    1.In the **Channels** section, click **Slack**.

    1. Navigate to **LangSmith Bot** and click **Add Channel**.
    2. Paste the channel ID and channel name.
  </Step>

  <Step title="Start a run">
    Send any message in the channel to start a run.
  </Step>
</Steps>

## Add Slack tools

Slack tools let your agent send messages, reply in threads, and read channel history. They work regardless of how the agent was triggered, whether through Slack, the Fleet UI, a schedule, or a webhook.

For example, you could start a long-running research task in the Fleet chat UI and instruct the agent to send you a Slack message when it's done.

<Tip>
  You can also ask your agent to add these tools itself. In the agent chat, try: "Add the Slack tools so you can respond to messages."
</Tip>

1. In the agent editor, scroll to the **Tools** section.
2. Click **+ Add**.
3. Search for "Slack" and add the tools you need, if not already added:
   * **slack\_send\_channel\_message**—Post messages to a channel
   * **slack\_reply\_to\_message**—Reply in a thread
   * **slack\_write\_private\_message**—Send direct messages
   * **slack\_read\_channel\_history**—Read recent messages
   * **slack\_read\_thread\_messages**—Read thread replies
4. If prompted, click **Connect** to authorize the Slack tools.
5. Click **Save changes**.

## Troubleshooting

### Agent does not respond

If your agent is not responding, you can try the following:

* Check the thread in Fleet for any approvals that need human input.
* Verify the bot was invited to the channel.
* Check the **Feed** tab for errors.
* Ensure the channel is not paused in the **Channels** section.
* Try reauthenticating with Slack to make sure Fleet has your most up-to-date Slack user ID stored.

### Not allowed to tag the bot

If you receive a private message saying you are not allowed to tag the bot, your Slack ID is not authorized for that agent. The agent's owner needs to share the agent with you—either by sharing run access with the whole workspace or with you individually.

## Next steps

<CardGroup cols={3}>
  <Card title="Add more tools" icon="puzzle" href="/langsmith/fleet/tools">
    Connect additional services to your agent
  </Card>

  <Card title="Add more channels" icon="bolt" href="/langsmith/fleet/channels">
    Set up email, schedule, or webhook channels
  </Card>

  <Card title="Use templates" icon="layout-grid" href="/langsmith/fleet/templates">
    Start from a prebuilt agent template
  </Card>
</CardGroup>

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/fleet/slack-app.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
