> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-maincl-1774016037-e3d94e8.mintlify.site/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, triggering 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.

<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) according to your organization's plan.

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

## 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 a Slack bot

<Steps>
  <Step title="Create a new Slack app">
    1. Navigate to the **Integrations** page in Fleet.
    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.

### Link 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.

### Link 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.

<Accordion title="Use the default LangSmith Slack bot">
  You can also use the default LangSmith Slack bot instead of a custom app:

  1. In the **Channels** section, click **LangSmith Bot**.
  2. In Slack, invite the default app to an existing channel and copy the channel ID.
  3. In the agent editor, click **Add Slack Channel** and paste the channel ID.
  4. Send any message in the channel to trigger a run.
</Accordion>

## Add Slack tools

Tools let your agent take actions. To respond in Slack, you need to add Slack tools.

<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**.

## 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.

## 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 trigger is not paused in the **Triggers** 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 triggers" icon="bolt" href="/langsmith/fleet/triggers">
    Set up email, schedule, or webhook triggers
  </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="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>

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