Slack
1. Configure the Slack App
-
Go to Slack API
-
Create a new app (or use an existing one)
- Choose to start from a blank app ("Blank app")
- Enter the App Name and select a Workspace
-
Get the app credentials:
- Client ID (in Basic Information → App Credentials)
- Client Secret (in Basic Information → App Credentials)
2. Configure App-Level Tokens
- In Basic Information → App-Level Tokens, click Generate Token and Scopes
- Enter a Token name (such as
connection_token) - Add the
connections:write,authorizations:read, andapp_configurations:writescopes - Click Generate
- Copy the generated Token in the
xapp-...format
3. Configure OAuth & Permissions
Slack requires HTTPS. If you don't have HTTPS, you can skip this configuration and bind with Method 1
On the Slack App management page → OAuth & Permissions:
3.1 Add Redirect URLs
https://your-domain:port/agent/api/slack-oauth/callback
Example:
- Local development: http://localhost:3000/api/slack-oauth/callback
- Test environment: https://your-test-domain.com/agent/api/slack-oauth/callback
- Production environment: https://your-domain.com/agent/api/slack-oauth/callback
Note:
- The protocol must match (HTTPS)
- If you don't use a default port (80/443), include the port number
- You can configure multiple callback URLs (development/test/production)
3.2 Configure User Token Scopes
In OAuth & Permissions → Scopes → User Token Scopes, add:
identity.basic- Get basic user information (required)identity.email- Get the user's email (optional)
Note: After you add or modify Scopes, you need to reinstall the app to the Workspace.
3.3 Configure Bot Token Scopes
In OAuth & Permissions → Scopes → Bot Token Scopes, add:
chat:write- Send messagesapp_mentions:read- Read @ mentionschannels:history- Read channel message historychannels:read- Read channel informationgroups:history- Read private channel message historyim:history- Read direct message historyim:read- Read direct message informationfiles:write- Upload, edit, and delete filesfiles:read- View shared files
4. Configure App Home and the bot
- In App Home → Show Tabs, enable:
- Home Tab - Users can interact with the Bot in Home
- Message Tab - The Bot's direct message interface
Select: Allow users to send Slash commands and messages from the messages tab
- In Interactivity & Shortcuts, enable Interactivity
- In Socket Mode, enable Socket Mode (if you use a WebSocket connection)
5. Add Event Subscriptions
- In Event Subscriptions, turn on Enable Events.
- In Subscribe to bot events, add
app_mentionto receive new tasks started by @mentioning the App in public or private channels. - Add
message.channelsandmessage.groupsto receive answers to pending questions and replies that continue execution in threads of public/private channels. - Keep
message.imto receive direct messages. If you also need group direct messages, you can addmessage.mpimand grant the corresponding message history permission.
Socket Mode, event, and interactivity checks:
- Grant the App-Level Token at least
connections:write, and turn on Enable Socket Mode. - Bot Token Scopes must include at least
chat:write,app_mentions:read,channels:history,groups:history,im:history,files:read, andfiles:write. - Interactivity must be turned on. In Socket Mode, no public Request URL is needed, but message forms, Modal submissions, and continuing execution still depend on Interactivity.
- After you modify OAuth Scopes or Bot Events, you must reinstall the App to the Workspace. After you regenerate the App-Level Token, you also need to update the App Token in the channel configuration.
6. Install the app to the Workspace
On the OAuth & Permissions page, click Install to Workspace to authorize the app to access the Workspace.
How to use
Method 1: Binding code (recommended)
Slack supports binding accounts in group chats with a binding code, which makes it easy to roll out within a team.
Bind a user account
- Log in to the system
- Click your avatar in the lower-left corner to open the menu
- Find the Slack row and click Get Binding Code
- The system generates a 6-character binding code (such as
FRT12H) that is valid for 10 minutes - Send a direct message to the bot in Slack:
+bind FRT12H - After binding succeeds, Slack shows a Binding successful message
Unbind an account
- Click your avatar in the lower-left corner to open the menu
- Find the Slack row and click Unbind
- Confirm the unbinding
- After unbinding succeeds, the menu shows the Unbound status
Method 2: OAuth authorization
Complete binding through browser authorization.
Bind a user account
- Log in to the system
- Click your avatar in the lower-left corner to open the menu
- Find the Slack row and click Bind
- You're redirected to the Slack authorization page
- Confirm the authorization (select a Workspace)
- You're automatically redirected back to the system, and Binding successful appears
- Close the authorization window. The original page refreshes automatically, and the menu shows the Bound status
Unbind a user account
- Click your avatar in the lower-left corner to open the menu
- Find the Slack row and click Unbind
- Confirm the unbinding
- After unbinding succeeds, the menu shows the Unbound status
Custom commands
The Slack bot supports the following commands (all commands start with +):
| Command | Description | Example |
|---|---|---|
+bind <CODE> | Binds an account with a binding code (6 uppercase letters + digits) | +bind FRT12H |
+new | Starts a new session and clears the current session history | Send +new |
+agent <名称> <消息> | Sends a message to the Agent with the specified name | +agent rhea 你好 |
+agent <消息> | Sends a message to the system default Agent | +agent 你好 |
Notes:
- Messages that don't start with
+are sent directly to the system default Agent - The
+bindcommand is used for the binding code method. Unbound users must bind their account before they can use other features - The
+newcommand clears the current session and starts over - The Agent name must be an Agent that the user has permission to access
- Command parameters are case-sensitive
- The binding code character set excludes easily confused characters (I/O/0/1)
Group chat message routing
Group chat message routing lets the same Slack App hand different questions to different Agents or Teams based on rules. A Group Chat Space corresponds to the current Workspace, and the configuration applies to channels in that Workspace where this App is installed. Only members who have bound an Agentic Engine account and explicitly @mention the App in the channel can start tasks.
Admin setup
- Make sure that Socket Mode, Event Subscriptions, and Interactivity are enabled, and that Bot Events include at least
app_mention,message.channels,message.groups, andmessage.im. After you modify scopes, reinstall the App to the Workspace. - Invite the App to the public or private channels where you want to use it. In a private channel, if the App isn't a member, it can't receive messages even if the configuration is correct.
- Go to System Admin → Channels, open Message Routing on the corresponding Slack channel, select the Workspace, and configure the default Agent/Team.
- Add up to 19 rules as needed. For each rule, select an Agent/Team, fill in the required Command, and optionally add up to 10 keywords. Then turn on the enable switch and save.
- Send
@App +helpin the channel to verify the setup, and make sure that the capability list and thread replies both work properly.
| Config items | Rule |
|---|---|
| Default Agent/Team | Required before enabling. Used when no command is specified and no keyword is matched. |
| Command | Required, 1–32 characters. You can use letters, digits, -, and _, but not system-reserved commands. Differences in letter case or between full-width and half-width characters don't make commands distinct. |
| Keywords | Optional. Up to 10 per rule, each 2–32 characters. When multiple keywords match, the longer keyword takes priority. If no unique match can be determined among keywords of the same length, the default Agent/Team is used. |
| Available options | You can select enabled and runnable system/company Agents, as well as Teams in the current company. Personal Agents don't appear as group chat routing candidates. |
Usage in channels
| Purpose | Example | Description |
|---|---|---|
| View available capabilities | @App +help@App 能力清单 | Lists the default, commands, and keywords. Capabilities that you don't have permission for or that can't currently run aren't shown. |
| Specify an Agent/Team | @App +analysis 分析本周数据 | analysis is a command configured by the admin. You can also send @App @analysis 分析本周数据. |
| Route by keyword | @App 帮我检查埋点方案 | When the message text matches a keyword, it's handed to the corresponding Agent/Team. Otherwise, the default is used. |
| Cancel a task | @App +cancel | Must be sent exactly as the entire message. Text already output is kept, and a separate cancellation confirmation is sent. |
| Legacy syntax | @App +agent analysis 分析本周数据 | Still supported, but using +analysis directly is recommended. |
Thread replies: You must @mention the App to start a regular new task. When a task is already waiting for an answer in a thread, you can reply directly in that thread as prompted without @mentioning the App again. Regular channel messages with no waiting task are ignored.
Command scope: Group chat routing doesn't support +new. Direct messages still support +new, +agent, and +cancel.
Public context and personal data: For reference, the system uses only recent public channel turns that explicitly @mentioned the App and were actually processed. Regular messages that don't @mention the App, other channels, direct messages, and personal memories are never mixed in. History serves only as untrusted reference, and only the current message is the instruction for this turn.
FAQ
1. The Slack binding option doesn't appear in the user menu
Reason:
- Slack channel is not configured or not enabled
- There is no record with type='slack' in the Channel table
- The config field is missing clientId or clientSecret
Solution:
- Check whether a Slack channel exists in Channels
- Make sure that the channel is enabled
- Make sure that the config field contains clientId and clientSecret
2. Redirect fails after you click Bind
Error message: Failed to get authorization URL
Solution:
- Check that the Client ID and Client Secret of the Slack App are correct
- Make sure that the Slack App is installed to the Workspace
- Check the backend logs for the specific error message
3. Callback fails after authorization
Error message: Callback URL verification failed, or state verification failed
Solution:
- Make sure that the Redirect URLs configured for the Slack App include the callback URL that you're currently accessing
- Check that the protocol (HTTP/HTTPS) and port match
- Make sure that there are no cross-origin issues
4. Binding failure
Error message: This Slack account is bound to another user
Solution:
- A Slack account can be bound to only one system user
- To change the binding, first unbind it from the original account
5. Production allowlist verification fails
Error message: ALLOWED_ORIGINS must be configured in the production environment, or Invalid origin
Solution:
- Configure the
ALLOWED_ORIGINSenvironment variable - Make sure that the origin is in the allowlist
- Separate multiple domains with commas
Related documents
Related pages and next steps
- See the setup instructions for other platforms: Channel management.
- Learn about the overall flow of channel connection and binding: Channel overview and binding.
- Configure the Agent to use: Agent.
- See how to use conversations in the platform: Conversations.

