中文 | English
目标:用 一个 Slack App 连接 OpenClaw,然后用"频道=岗位"绑定多个 Agent;后续增减 Agent 只需要增减频道 + 配置绑定。
OpenCrew 默认使用 Slack Socket Mode(不需要公网 webhook)。
完成后你将拥有:
- 一个 Slack App(包含一个 bot)
- 两个 token:
- App Token:
xapp-...(Socket Mode 需要) - Bot Token:
xoxb-...
- App Token:
- OpenClaw 已连接 Slack,并且 bot 被邀请进你希望使用的频道
- 打开 https://api.slack.com/apps → Create New App(From scratch)
- Socket Mode → Enable
- Basic Information → App-Level Tokens → Generate Token and Scopes
- 添加 scope:
connections:write - 生成并复制 App Token(
xapp-...)
- 添加 scope:
在 OAuth & Permissions → Bot Token Scopes 添加(OpenClaw 官方建议的最小集合):
chat:writeim:writechannels:history,groups:history,im:history,mpim:historychannels:read,groups:read,im:read,mpim:readusers:readreactions:read,reactions:writepins:read,pins:writeemoji:readfiles:writefiles:read
然后点击 Install to Workspace,复制 Bot User OAuth Token(xoxb-...)。
在 Event Subscriptions → Enable Events,订阅以下事件(OpenClaw 文档建议):
message.*(包括编辑/删除/线程广播)app_mentionreaction_added,reaction_removedmember_joined_channel,member_left_channelchannel_renamepin_added,pin_removed
在本机终端执行(把 token 换成你自己的):
openclaw channels add --channel slack \
--app-token "xapp-..." \
--bot-token "xoxb-..."这一步会把 Slack 配置写入
~/.openclaw/openclaw.json(比手动编辑更稳)。
然后重启 gateway:
openclaw gateway restart验证 Slack 是否在线:
openclaw channels status --probe
# 或
openclaw status最小配置(3 个频道,推荐先从这里开始):
#hq(CoS 幕僚长)#cto(CTO 技术合伙人)#build(Builder 执行者)
按需扩展:
#invest(CIO 领域专家,可选)#know(KO 知识官,可选)#ops(Ops 运维官,可选)#research(Research 调研员,可选)
然后在每个频道里 /invite @<你的bot名字>。
如果 bot 没在频道里,通常无法读取历史/也可能无法发言(除非你额外配置
chat:write.public,不建议给新手用)。
右键频道名 → Copy link → 链接中的 C0XXXXXXXX 就是 Channel ID。
openclaw channels resolve --channel slack "#hq" --json