# Connect an agent to Slack

Source: https://agenta.ai/docs/guides/connect-slack

Connect an agent to Slack, and your team can mention it in a channel or send it a direct message. The agent answers in a thread, right where your team already works.

[Video](https://watch.cloudflarestream.com/391096c48f236d79358e21ba0b16a890)

There are two ways to connect. The Agenta app takes one click. Your own Slack app gives the assistant its own name and avatar, and takes about 5 minutes.

## Before you start

You need:

- **An agent in Agenta** that you want your team to use in Slack. It can be shared with the project or private. Only the owner of a private agent can connect it. See [Share agents and chats](https://agenta.ai/docs/guides/share-agents-and-chats.md).
- **Permission to install apps** in your Slack workspace. To connect your own app, you also need permission to create apps.

:::info
For a shared agent, everyone in the project can read its Slack conversations in Agenta, including direct messages. See [Who can read Slack conversations](#who-can-read-slack-conversations).
:::

## Connect with the Agenta app

The Agenta app needs no manifest and no secrets.

1. Open the agent and go to **Channels** in its sidebar.
2. Under **Add a channel**, click **Slack**. The **Connect Slack** page opens.
3. Under **Connect with**, keep **Agenta app**, then click **Add to Slack**.
4. Finish the install in the Slack window that opens. If the window does not open, click **Open it here**.

Then [choose where the assistant answers](#choose-where-the-assistant-answers). If Agenta shows "This deployment has no hosted Slack app", connect your own app instead.

## Connect your own Slack app

Use your own app to give the assistant its own name and avatar.

### 1. Name the assistant in Agenta

1. Open the agent and go to **Channels** in its sidebar.
2. Under **Add a channel**, click **Slack**.
3. Under **Connect with**, choose **Your own app**, then **New app**, and click **Continue**. To reuse an app you already created in Slack, choose **Existing app** and go to [step 3](#3-paste-the-apps-credentials-into-agenta).
4. In the **Name** step, set how the assistant shows up in Slack. Agenta fills the fields from the agent:
   - **Name**: the display name, such as `Outreach drafter`.
   - **Handle**: what people type to mention it, such as `@outreachdrafter`. Use letters, numbers, periods, hyphens, and underscores.
   - **Description**: one short sentence on what it does.
5. Click **Next**.

### 2. Create the Slack app from the manifest

1. In the **Create app** step, click **Copy** to copy the manifest. Agenta fills it with the name, handle, and description you entered.
2. Click **Open Slack app settings**.
3. In Slack, click **Create New App**, then choose **From a manifest**.
4. Select your workspace, paste the manifest, and click **Next**.
5. Review what the app can do, then click **Create and Install** to install it to your workspace.

### 3. Paste the app's credentials into Agenta

Copy three values from the app's settings in Slack:

| Agenta field | Where to find it in Slack |
|---|---|
| **App ID** | **Basic Information**. It starts with `A`. Do not use the Client ID. |
| **Signing Secret** | **Basic Information** |
| **Bot User OAuth Token** | **Install App** |

Paste them into the **Connect** step in Agenta, then click **Connect app**. Agenta checks the values with Slack before it saves them. After saving, they stay masked.

## Choose where the assistant answers

After the app connects, the Slack panel shows the app as **Live**. Under **Answers in**, choose where the assistant responds:

- **Direct messages**: anyone in the workspace can send it a direct message.
- **Channels**: it replies in a thread when someone mentions it in a channel.

To add the assistant to channels, click **Add channel** and pick one or more channels. The app joins public channels itself. For a private channel, run `/invite @outreachdrafter` in that channel first. The channels then appear under **Channels it's in**. In the video, the assistant is added to an `#outreach` channel with channel replies turned on.

To answer in some channels only, open **Advanced** and set **Channels it answers in** to **Only these channels**, then check the channels. A channel you leave unchecked stays in the list, marked **Off**. A channel the assistant joins later stays off until you check it. Group DMs count as channels.

### Choose who can message it

Under **Access**, **Who can message it** is **Everyone** by default. Choose **Specific people** to limit the assistant to a list. Search people by name, or type a full email. The list applies to this agent only, in direct messages and in channels.

When someone who is not on the list mentions the assistant or sends it a direct message, they get one short private note, at most once a day. The same happens when someone mentions it in a channel it does not answer in, or sends it a direct message while **Direct messages** is off. Only the owner of a private agent can change these settings.

## Mention the agent in Slack

In the channel, mention the agent and ask for what you need. For example:

> @outreachdrafter Find the five newest contacts added to HubSpot this week. Research their companies and draft a personalized welcome email for each, signed John. Show me the research and drafts for review before sending.

The agent reacts with 👀 when it picks up your request. Open the thread to follow its response. When it has finished, the 👀 changes to ✅.

Anyone in the channel can mention the agent the same way to ask questions, request drafts, and review the results together in the thread.

## Manage the connection

Open the agent's **Channels** page and click **Slack** to come back to the connection. From there you can:

- Turn **Direct messages** and **Channels** on or off.
- See the channels the assistant is in, and add several at once with **Add channel**.
- Choose who can message it under **Access**.
- Update the app credentials under **Access**.
- Add another workspace or another Slack app.
- **Disconnect** the app.

Changes save automatically.

## Who can read Slack conversations

Slack conversations with the agent are chats in Agenta, including direct messages. For an agent that is shared with the project, everyone in the project can read these chats and send to them in Agenta. They have no owner. For a private agent, new chats belong to the agent's owner. Only the owner, and the people the owner shares a chat with, can see them. When you pick the agent, Agenta shows this notice with your project's name. For a project named Acme support: "For a shared agent, everyone in Acme support can read its Slack conversations in Agenta, including direct messages. For a private agent, new conversations are private to its owner." Chats that already exist keep who can see them, and the owner can share a private chat.

Everyone in the Slack channel who may message the agent under **Who can message it** can talk to it, also when the agent is private. When someone sends a message to one of these chats in Agenta, the agent's answer also goes to the Slack thread.

A private agent in Slack can read the volumes it lists, also its owner's private volumes. So anyone who may message it in the Slack channel can ask it about the files in those volumes.

## If the agent becomes private

When the owner makes a connected agent private, the agent keeps answering in Slack through the connections the owner made. A connection that another member made stops answering; the owner can connect the agent again. New Slack chats with it are private to the owner. Chats that already exist keep who can see them.

If a connection is off, open it in **Channels** and click **Turn on**.

## Other channels

You can publish the same agent to Discord, Microsoft Teams, Telegram and WhatsApp from the same **Channels** page. See [Connect Discord](https://agenta.ai/docs/guides/connect-discord.md), [Connect Microsoft Teams](https://agenta.ai/docs/guides/connect-microsoft-teams.md), [Connect Telegram](https://agenta.ai/docs/guides/connect-telegram.md) and [Connect WhatsApp](https://agenta.ai/docs/guides/connect-whatsapp.md).
