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

# Custom Slack apps

> Give an Agent its own Slack app for channel mentions, direct messages, delegation, and approvals.

A custom Slack app answers as one specific Erstan Agent, using its own name, bot account, and Slack installation. Configure it in the Agent's **Triggers** section. An Agent can have several custom apps; an app has one Agent assignment at a time.

## Before you start

* Save the Agent with a single Chat trigger and confirm it is ready to run.
* You need edit access to the Agent and permission to create and install apps in your Slack workspace.
* People using the app need an Erstan account whose email matches their Slack profile, access to the Agent, and membership in the connection's workspace or team as selected during setup.

## Create an app

<Steps>
  <Step title="Choose the custom app option">
    Open **Agents → your Agent → Triggers → Add trigger**. Choose **Slack Trigger**, click **Add trigger**, then choose **New custom app**. Choose **Use @erstan in a channel** to assign the shared bot to this Agent in a selected channel.
  </Step>

  <Step title="Set the app details">
    Enter the app name, the tag people mention, and an optional description. Choose **Workspace members**, **Only me**, or **This Agent's team** when a team is available. Click **Continue**.
  </Step>

  <Step title="Create and install in Slack">
    Copy the generated manifest and open Slack's app dashboard. Choose **Create New App → From an app manifest**, select the workspace, and paste the JSON. Save and install the app. The manifest enables event subscriptions, interactive approvals, and a writable Messages tab. Set the icon in Slack's **Basic Information → Display Information**.
  </Step>

  <Step title="Connect the credentials">
    In Slack, open **Basic Information → App Credentials**. In Erstan's next step, enter **Client ID**, **Client Secret**, and **Signing Secret**, then click **Connect to Slack**. Complete authorization in the popup. Erstan encrypts these secrets on the server.
  </Step>

  <Step title="Start a conversation">
    Use the displayed invite command in a channel, then mention the app. You can also open a DM using **Open in Slack**. A new top-level message starts a conversation; reply in its thread to continue.
  </Step>
</Steps>

Setup stays in the trigger's settings pane through **App details**, **Slack setup**, and **Connect**. Only Slack authorization opens a popup. Use **Save and close** to return later: the saved trigger has one **Continue setup** action, and adding Slack again resumes that unfinished setup. Connected Slack apps and channel bindings appear beside Chat and your other triggers in **Inputs**.

## Use the shared Erstan app

Choose **Use @erstan in a channel** to make this Agent the default responder in a channel. If the shared app is not connected, select **Connect Erstan to Slack** and complete authorization in the popup. The channel picker appears here automatically afterward.

Active channels the app has joined load from Slack automatically. Search by channel name, select a channel, and click **Assign channel**. For a missing channel, invite `@erstan` in Slack and use **Refresh channels**. Private channels appear only when the app has access. A workspace owner or admin manages the shared installation and channel assignments.

New conversations with `@erstan` in that channel start this Agent directly. Asking the general Erstan assistant to delegate is useful for individual requests; assigning a channel saves that starting choice. The Agent's delegation, access, and approval rules still apply. **Manage Slack connection** opens workspace administration separately and preserves your trigger setup.

## Connect an existing app

Choose **Existing Slack app**. In the setup instructions, expand **Manifest and manual configuration** for the exact OAuth redirect, event subscription, interactivity URL, bot scopes, and bot events. Merge these into the existing Slack app's configuration, enable a writable Messages tab, reinstall, and connect its credentials.

Changing an existing app's event URL redirects its events to Erstan. Use an app intended for this Agent. Each installation connects to one Slack workspace; token rotation must be disabled.

## Conversation settings

| Setting                     | Behavior                                                                                                                                                                                                                                            |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Thread replies              | Answer every message in an established channel thread, or require an explicit mention. DMs do not require a mention.                                                                                                                                |
| Show delegation updates     | Show short progress updates about delegated work.                                                                                                                                                                                                   |
| Receive messages            | Pause or enable the app connection.                                                                                                                                                                                                                 |
| Use for Slack message steps | Choose which bot sends configured Slack message steps during Erstan chats and scheduled runs. An inbound Slack conversation keeps its originating bot, including delegated work. Personal Slack connector tools retain their own connected account. |

In a thread, send **`!link`** to open your run in Erstan or **`!stop`** to request cancellation. These controls only access your own run. Approval buttons use the same permissions and durable decisions as the Erstan app. Requests for more information use the existing conversation reply flow.

## Reconnect, reassign, or remove

* **Reconnect** uses the saved credentials. Select **Update credentials** to replace them. If the trigger needs permissions, use **Update permissions**, apply the displayed configuration in Slack, and reconnect.
* **Test connection** checks the current bot token and installation identity.
* To move a connected app, add a **Slack Trigger** in another Agent, choose **Use a connected app**, review the assignment, and confirm **Assign app**. You need edit access to both Agents. Start a new Slack thread afterward; existing runs stay with their original Agent.
* **Remove trigger** deletes the Erstan connection after confirmation. Uninstall the app separately in Slack if you also want to revoke its installation there.

## Troubleshooting

| Problem                                        | What to check                                                                                                                                                                                                                                           |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Needs a Chat trigger                           | Save one unambiguous Chat trigger on the Agent, then continue setup.                                                                                                                                                                                    |
| Slack cannot verify the event URL              | Use the exact generated URL. The API must be publicly reachable over HTTPS. After saving credentials, save Event Subscriptions again if Slack requests verification. An untouched draft handshake expires after 24 hours; create a new draft if needed. |
| Cannot send DMs                                | Enable the Messages tab and allow messages to the app; verify the manifest's DM scopes and events, then reinstall.                                                                                                                                      |
| App does not respond in a channel              | Invite the app, mention its bot, and check Receive messages, thread settings, and the sender's Erstan access.                                                                                                                                           |
| OAuth popup was closed                         | Reopen Connect to Slack. A completed installation is recovered when the popup closes.                                                                                                                                                                   |
| Reconnect reports a different app or workspace | Use the original installation, or create a separate Erstan connection for the new app.                                                                                                                                                                  |
| Credential encryption key is missing           | Ask the server operator to configure `SLACK_CUSTOM_APP_CREDENTIAL_SECRET` on API and worker instances.                                                                                                                                                  |

Custom app setup does not add new Slack tool types. Approvals and conversation replies use Erstan's existing Slack capabilities; arbitrary Slack forms, modal authoring, and personal connector authentication remain separate features.
