# Configure Slack

Slack has two independent MOI entries:

- **Bot messages:** an agent sends messages to a specified Slack channel.
- **Event callbacks:** Slack sends events to MOI, which routes them to a specified agent or task.

Complete the first section for outbound messages. Continue to event callbacks only when new Slack events should trigger MOI.

## Part 1: Bot messages

### 1. Create a Slack app

Open [Slack API Apps](https://api.slack.com/apps) and select **Create an App**. Choose **Blank app**, then **Continue**. MOI needs an ordinary messaging app for this flow rather than the AI agent template.

Enter an app name, such as “MOI notifications,” select the intended Slack workspace, and choose **Create**.

### 2. Allow the bot to send

Open **OAuth & Permissions** in the app sidebar. Under **Bot Token Scopes**, add `chat:write`, which allows the bot to send messages in channels it has joined.

Open **Install App** and install it in the workspace. If **Reinstall to Workspace** is shown, use that action. After authorization, return to **OAuth & Permissions → OAuth Tokens** and copy **Bot User OAuth Token**, which starts with `xoxb-`.

### 3. Configure the MOI bot instance

Open **Resource Center → Tools → Slack → Add → Bot messages**. Fill and save the form:

| MOI field | Value |
| --- | --- |
| Tool instance name | A name such as “Project Slack notifications” |
| Description | Optional purpose, such as project-channel notifications |
| App ID | Optional; records the Slack app identity |
| Team ID | Optional; identifies the workspace when restricting to a particular workspace |
| Bot Token | The `xoxb-` Bot User OAuth Token |
| Connection timeout (seconds) | Optional; default 30 |

Invite the bot to a test channel in Slack, for example using `/invite @your-bot-name`. Bind the instance to the agent and request an explicitly defined test message to that channel. Confirm receipt in the channel to validate outbound messaging.

## Part 2: Event callbacks

Event callbacks allow Slack to notify MOI of events such as new channel messages. MOI then triggers the target agent or task according to your rules.

### 1. Create an event instance in MOI

Open **Resource Center → Tools → Slack → Add → Event callback**. This entry uses a **Signing Secret**, not a Bot Token. Obtain it from the same Slack app under **Basic Information → App Credentials → Signing Secret**.

| MOI field | Value |
| --- | --- |
| Tool instance name | A name such as “Project channel events” |
| App ID / Team ID | Optional identifiers for the app or workspace |
| Signing Secret | The same app's signing secret from App Credentials |
| Connection timeout (seconds) | Optional; default 30 |

Save, open the instance details, and copy its **Public callback URL**. This is the **Request URL** to enter in Slack.

### 2. Configure HTTP event delivery in Slack

1. Open the same app in [Slack API Apps](https://api.slack.com/apps).
2. If Socket Mode is enabled, open **Socket Mode** and turn off **Enable Socket Mode**. HTTP Request URL is not shown while Socket Mode is enabled. The switch takes effect immediately without a separate save button.
3. Open **Event Subscriptions** and turn on **Enable Events**.
4. Paste the complete MOI public callback URL into **Request URL**. Slack verifies it immediately; wait for **Verified**.
5. Expand **Subscribe to bot events** and add only the required events. For an initial channel-message test, add `message.channels`.
6. Apply the associated `channels:history` permission when Slack prompts for it, then select **Save Changes**.
7. If **Reinstall to Workspace** appears after adding events or permissions, reinstall so the additions take effect.

### 3. Configure MOI routing and test

Return to the MOI event instance and select **Add rule**. Choose the agent or task that should receive matching Slack events. Slack's **Verified** state establishes endpoint verification, not agent routing.

Invite the bot to the test channel and send an ordinary test message there. Verify all four conditions:

- The Slack Request URL is **Verified**.
- The required event subscription, such as `message.channels`, is saved.
- An enabled MOI forwarding rule points to the correct agent or task.
- The test message triggers that target.

## Troubleshoot

| Symptom | Resolution |
| --- | --- |
| No Request URL field | Disable Socket Mode, then reopen Event Subscriptions |
| Save Changes disabled | Verify the URL and add or change an event subscription; the button is disabled when nothing needs saving |
| URL not Verified | Check the complete MOI public callback URL and a Signing Secret from the same Slack app |
| Bot cannot send to the channel | Check `xoxb-` token, installation after permission changes, and bot membership |
| Slack verified but MOI does not run | Create and enable a forwarding rule on the event instance with the intended target |

- [Slack API Apps](https://api.slack.com/apps)
- [Slack app settings and installation](https://docs.slack.dev/app-management/quickstart-app-settings/)
- [Slack HTTP Request URLs and events](https://docs.slack.dev/apis/events-api/using-http-request-urls/)
- [All tool configuration guides](index.md)
