# Slack 配置 OpenClaw Bot 完整步骤 ## 第一步:在 Slack API 创建 App 1. 访问 [Slack API](https://api.slack.com/apps) 并登录 2. 点击 **"Create New App"** → 选择 **"From an app manifest"** 3. 选择要创建的工作区 4. 粘贴下方的 Manifest JSON(根据需要修改名称) ```json { "display_information": { "name": "YourBotName", "description": "OpenClaw connector for Slack", "background_color": "#1d7c00" }, "features": { "app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false }, "bot_user": { "display_name": "YourBotName", "always_online": true } }, "oauth_config": { "scopes": { "bot": [ "im:write", "app_mentions:read", "assistant:write", "channels:history", "channels:read", "chat:write", "chat:write.customize", "chat:write.public", "emoji:read", "files:read", "files:write", "groups:history", "groups:read", "groups:write", "im:history", "im:read", "mpim:history", "pins:read", "pins:write", "reactions:read", "reactions:write", "usergroups:read", "usergroups:write", "users:read", "users:write" ] } }, "settings": { "event_subscriptions": { "bot_events": [ "app_mention", "message.channels", "message.groups", "message.im", "message.mpim", "reaction_added", "reaction_removed", "member_joined_channel", "member_left_channel", "channel_rename", "pin_added", "pin_removed" ] }, "interactivity": { "is_enabled": true }, "org_deploy_enabled": false, "socket_mode_enabled": true, "token_rotation_enabled": false } } ``` ## 第二步:安装 App 到工作区 1. 在左侧菜单点击 **"Install"** 2. 点击 **"Install to Workspace"** 3. 授权后获取 **Bot User OAuth Token** (格式: `xoxb-...`) ## 第三步:获取 App Level Token 1. 在左侧菜单点击 **"Basic Information"** 2. 滚动到 **"App-Level Tokens"** 部分 3. 点击 **"Generate Token and Scopes"** 4. 添加 `connections:write` 权限 5. 生成并获取 **App Level Token** (格式: `xapp-1-...`) ## 第四步:添加 Channel 到 OpenClaw ```bash openclaw channels add --channel slack --account <账号名> --bot-token --app-token ``` **参数说明:** - `--account`: 给这个 Slack 连接起的名字(如 xingyao, xingshu) - `--bot-token`: 第一步获取的 Bot User OAuth Token - `--app-token`: 第三步获取的 App Level Token ## 第五步:绑定 Agent 到 Slack 账号 ```bash openclaw agents bind --agent --bind slack:<账号名> ``` **参数说明:** - `--agent`: 要绑定的 OpenClaw agent 名称 - `--bind`: 格式为 `slack:<账号名>`,账号名与第四步一致 ## 第六步:验证连接 1. 在 Slack 中向 Bot 发送私信或 @Bot 提及 2. 确认 OpenClaw 能够接收和响应消息 --- ### 现有 Bot 配置信息(请勿修改) ### 星枢 - Bot User OAuth Token ``` xoxb-10749198837424-10729993030356-fZMcpT9AwVYjpZAoALh9G3Pf ``` - App Level Token ``` xapp-1-A0ALWUV7P7H-10720045898595-6d84e6b3c450587efe928459ab3ccfdefac2f7cb506ff741aabce688977644e8 ``` - Add Channel ``` openclaw channels add --channel slack --account xingshu --bot-token xoxb-10749198837424-10729993030356-fZMcpT9AwVYjpZAoALh9G3Pf --app-token xapp-1-A0ALWUV7P7H-10720045898595-6d84e6b3c450587efe928459ab3ccfdefac2f7cb506ff741aabce688977644e8 ``` - Bind Agent ``` openclaw agents bind --agent main --bind slack:xingshu ``` ### 星曜 - Bot User OAuth Token ``` xoxb-10749198837424-10717815209651-z0T78ljkOGeNddAWcajl2Wxg ``` - App Level ``` xapp-1-A0AMDPLP99A-10722160508566-6cedd2c05c0a338435aaab98c9449ef01437b315b049850ba574ff67c1fbd68b ``` - Add Channel ``` openclaw channels add --channel slack --account xingyao --bot-token xoxb-10749198837424-10717815209651-z0T78ljkOGeNddAWcajl2Wxg --app-token xapp-1-A0AMDPLP99A-10722160508566-6cedd2c05c0a338435aaab98c9449ef01437b315b049850ba574ff67c1fbd68b ``` - Bind Agent ``` openclaw agents bind --agent xingyao --bind slack:xingyao ``` ### 星辉 - Bot User OAuth Token ``` xoxb-10749198837424-10724815197190-kEkxZmkBKQrYnY8Ov2hadu3O ``` - App Level ``` xapp-1-A0AMCRT5E10-10720526191091-9ed0aff401f0feb16994d9d20a5256b6417fa83e0b743c1d63f8a8838fba822f ``` - Add Channel ``` openclaw channels add --channel slack --account xinghui --bot-token xoxb-10749198837424-10724815197190-kEkxZmkBKQrYnY8Ov2hadu3O --app-token xapp-1-A0AMCRT5E10-10720526191091-9ed0aff401f0feb16994d9d20a5256b6417fa83e0b743c1d63f8a8838fba822f ``` - Bind Agent ``` openclaw agents bind --agent xinghui --bind slack:xinghui ``` ### 云匠 ``` xapp-1-A0ANEGJTQKS-10730870512613-38e052035fd3fe267f09ef0cb3f007c0f2ea6a1f44a9fb6a34deba2505797ea8 ``` ``` xoxb-10761503478464-10718827766407-EF5ko4RpZ4IhhXemRxK20eFz ``` ``` openclaw channels add --channel slack --account yunjiang --bot-token xoxb-10761503478464-10718827766407-EF5ko4RpZ4IhhXemRxK20eFz --app-token xapp-1-A0ANEGJTQKS-10730870512613-38e052035fd3fe267f09ef0cb3f007c0f2ea6a1f44a9fb6a34deba2505797ea8 ``` ``` openclaw agents bind --agent yunjiang --bind slack:yunjiang ``` # Create app from manifest ``` { "display_information": { "name": "XingHui", "description": "OpenClaw connector for OpenClaw", "background_color": "#1d7c00" }, "features": { "app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false }, "bot_user": { "display_name": "XingHui", "always_online": true } }, "oauth_config": { "scopes": { "bot": [ "im:write", "app_mentions:read", "assistant:write", "channels:history", "channels:read", "chat:write", "chat:write.customize", "chat:write.public", "emoji:read", "files:read", "files:write", "groups:history", "groups:read", "groups:write", "im:history", "im:read", "mpim:history", "pins:read", "pins:write", "reactions:read", "reactions:write", "usergroups:read", "usergroups:write", "users:read", "users:write" ] } }, "settings": { "event_subscriptions": { "bot_events": [ "app_mention", "message.channels", "message.groups", "message.im", "message.mpim", "reaction_added", "reaction_removed", "member_joined_channel", "member_left_channel", "channel_rename", "pin_added", "pin_removed" ] }, "interactivity": { "is_enabled": true }, "org_deploy_enabled": false, "socket_mode_enabled": true, "token_rotation_enabled": false } } ```