Enterprise Grid
在组织级别安装一次,然后设置工作区限定的策略键。
Enterprise Grid 全组织安装¶
一个 Slack 账户可以接收由 Enterprise Grid 全组织安装所覆盖的所有工作区中的消息和交互。选择直接 Socket Mode 或 HTTP Request URLs;企业账户不支持 relay 模式。下面两个最小权限清单均启用 Enterprise 消息、提及、反应、固定、频道创建和频道重命名事件路径、即时回复、由监听器拥有的状态反应、用于 Block Kit 操作和模态框提交的 Slack 交互性,以及唯一的 /openclaw 斜杠命令。
Socket Mode¶
{
"display_information": {
"name": "OpenClaw",
"description": "Slack connector for OpenClaw"
},
"features": {
"bot_user": { "display_name": "OpenClaw", "always_online": true },
"slash_commands": [
{
"command": "/openclaw",
"description": "Send a message to OpenClaw",
"should_escape": false
}
]
},
"oauth_config": {
"scopes": {
"bot": [
"app_mentions:read",
"channels:history",
"channels:read",
"chat:write",
"commands",
"files:read",
"files:write",
"groups:history",
"groups:read",
"im:history",
"im:read",
"mpim:history",
"mpim:read",
"pins:read",
"reactions:read",
"reactions:write",
"users:read"
]
}
},
"settings": {
"org_deploy_enabled": true,
"socket_mode_enabled": true,
"interactivity": { "is_enabled": true },
"event_subscriptions": {
"bot_events": [
"app_mention",
"channel_created",
"channel_rename",
"message.channels",
"message.groups",
"message.im",
"message.mpim",
"member_joined_channel",
"member_left_channel",
"pin_added",
"pin_removed",
"reaction_added",
"reaction_removed"
]
}
}
}
请 Enterprise Grid Org Admin 或 Org Owner 批准该应用,在组织级别安装它,并选择该安装所覆盖的工作区。在启动 OpenClaw 之前,确认该应用已在每个预期工作区中可用。为 Socket Mode 生成具有 connections:write 权限的应用级 token,然后从组织安装中复制 bot token。配置使用组织安装 bot token 的账户:
{
channels: {
slack: {
enabled: true,
mode: "socket",
appToken: { source: "env", provider: "default", id: "SLACK_APP_TOKEN" },
botToken: { source: "env", provider: "default", id: "SLACK_BOT_TOKEN" },
slashCommand: { enabled: true, name: "openclaw" },
dmPolicy: "open",
allowFrom: ["*"],
groupPolicy: "allowlist",
channels: {
C0123456789: { requireMention: true },
},
},
},
}
HTTP Request URLs¶
当 Gateway 具有公共 HTTPS 端点且不打开 Socket Mode 连接时,使用 HTTP 模式。将示例 URL 替换为 Gateway 的公共 webhookPath URL(默认 /slack/events):
{
"display_information": {
"name": "OpenClaw",
"description": "Slack connector for OpenClaw"
},
"features": {
"bot_user": { "display_name": "OpenClaw", "always_online": true },
"slash_commands": [
{
"command": "/openclaw",
"description": "Send a message to OpenClaw",
"should_escape": false,
"url": "https://gateway-host.example.com/slack/events"
}
]
},
"oauth_config": {
"scopes": {
"bot": [
"app_mentions:read",
"channels:history",
"channels:read",
"chat:write",
"commands",
"files:read",
"files:write",
"groups:history",
"groups:read",
"im:history",
"im:read",
"mpim:history",
"mpim:read",
"pins:read",
"reactions:read",
"reactions:write",
"users:read"
]
}
},
"settings": {
"org_deploy_enabled": true,
"interactivity": {
"is_enabled": true,
"request_url": "https://gateway-host.example.com/slack/events"
},
"event_subscriptions": {
"request_url": "https://gateway-host.example.com/slack/events",
"bot_events": [
"app_mention",
"channel_created",
"channel_rename",
"message.channels",
"message.groups",
"message.im",
"message.mpim",
"member_joined_channel",
"member_left_channel",
"pin_added",
"pin_removed",
"reaction_added",
"reaction_removed"
]
}
}
}
请 Enterprise Grid Org Admin 或 Org Owner 批准该应用,在组织级别安装它,并选择该安装所覆盖的工作区。在 Slack 验证 Request URL 后,复制组织安装的 bot token 以及应用的 Basic Information -> App Credentials -> Signing Secret。使用相同的 Request URL 路径配置企业账户:
{
channels: {
slack: {
enabled: true,
mode: "http",
botToken: { source: "env", provider: "default", id: "SLACK_BOT_TOKEN" },
signingSecret: {
source: "env",
provider: "default",
id: "SLACK_SIGNING_SECRET",
},
slashCommand: { enabled: true, name: "openclaw" },
webhookPath: "/slack/events",
dmPolicy: "open",
allowFrom: ["*"],
groupPolicy: "allowlist",
channels: {
"team:T0123456789:channel:C0123456789": { requireMention: true },
},
},
},
}
对于每个选定的工作区,在 Slack 的 Web 应用中打开它,并从 https://app.slack.com/client/T.../... 复制 T... 工作区 ID。在每一个限定策略键中,将该工作区 ID 与频道的 C... ID 一起使用,如上文所示。
启动时,OpenClaw 使用 Slack auth.test 检测该 token 属于工作区安装还是 Enterprise Grid 全组织安装。无需安装模式设置。Slack 仍然是哪些工作区已授予该安装的权威来源;随后 OpenClaw 将已配置的频道、用户、DM 和提及策略应用于每个已交付事件。企业安装默认将 allowBots 设为 true,具有与工作区安装相同的频道访问、提及、bot 房间授权和循环防止规则。在账户或频道上设置 allowBots: false 以禁用由 bot 触发的轮次。OpenClaw 保留组织安装的 auth.test user_id 和 bot_id,以忽略其自身消息。
企业版支持直接 Socket Mode 或 HTTP 消息、提及(mention)、成员(membership)、表情回应(reaction)、置顶(pin)、频道创建(channel-created)、频道重命名(channel-renamed)、Block Kit 操作、模态框(modal),以及已配置的快捷方式和斜杠命令负载(payload),还包括工作区限定的外发消息和在线状态轮询(presence polling)。请将所有快捷方式添加到应用清单(manifest)的 features.shortcuts 列表中;OpenClaw 通过同一交互路径接受其回调 ID。清单示例注册了单个 /openclaw 命令;原生命令模式仍需要管理员管理的命令条目,详见可选的原生斜杠命令。中继模式(Relay mode)、频道 ID 变更事件、App Home、Agent 和 Assistant 生命周期事件、已配置的 ACP 绑定,以及运行时的当前会话绑定,在企业版账户中仍然不可用。
静态 Agent 路由绑定在以下情况下受支持:无对端的绑定指定了 match.teamId,或对端 ID 使用 team:<team-id>:channel:<channel-id> 或 team:<team-id>:user:<user-id>。源自已投递且工作区限定的 Slack 交互回合(turn)的 Slack 原生审批受支持;审批按钮使用相同的监听方持有(listener-owned)、工作区作用域的交互路径。企业版账户在操作与门控列出的所有组中均支持 Slack 操作工具;已配置的 channels.slack.actions.* 门控和 OAuth 作用域仍然适用。入站成员、表情回应、置顶、频道创建和频道重命名通知使用经过验证的监听方持有、工作区作用域的事件路由。出站确认(acknowledgment)、输入状态(typing)和状态表情回应也通过该客户端受支持,并需要 reactions:write。
OpenClaw 将 Enterprise Grid 目的地记录为 team:<team-id>:channel:<channel-id> 或 team:<team-id>:user:<user-id>。当前会话的 Slack 工具操作继承该工作区。心跳(heartbeat)所有者路由可以通过对照发送机器人已安装的工作区验证接收者的成员身份,然后选择一个共享工作区来解析裸用户 ID。显式的工作区限定所有者目标会被保留。如果该验证失败,分离发送(detached-send)保护仍然生效。其他分离式或主动式调用必须提供工作区限定的目标;裸频道 ID 和用户 ID 会默认拒绝(fail closed),因为这些 ID 可能被不同的工作区复用。没有目标参数的操作(如 member-info 和 emoji-list)需要受信任的当前 Slack 会话上下文。
即时回复复用标准 Slack 投递行为,包括分块(chunks)、媒体、元数据、身份回退(identity fallback)、链接展开(unfurls)和回执(receipts),但仅限于经过验证的监听方持有客户端仍处于活动事件回合(event turn)期间。内存中的发送队列和线程参与记录按该事件的工作区分区;客户端本身永远不会被序列化或持久化。
企业版频道策略键必须使用 team:<team-id>:channel:<channel-id> 或 "*" 通配符。dm.groupChannels 要求使用工作区限定的形式,并且不接受 "*"。已投递的企业版事件绝不会从限定的工作区和频道身份回退为裸频道 ID。工作区安装保留原始稳定频道 ID 和 channel:<id> 兼容性。频道前缀 slack:、group: 和 mpim: 会导致启动失败。
allowFrom、reactionAllowlist 和按频道 users 中的企业版用户策略条目接受原始稳定 Slack 用户 ID、slack:<user-id>、user:<user-id>、team:<team-id>:user:<user-id> 或 "*"。未限定的条目仅比较用户 ID,可以匹配任何工作区中的组织级用户。限定的条目同时比较工作区和用户 ID。企业版 toolsBySender 键接受 id:<sender-id>、channel:slack:<sender-id> 或 "*",包括稳定机器人 ID(如 id:B0123456789)。运行 openclaw doctor --fix 以迁移未加前缀的发送者 ID。名称、别名(slugs)、显示名称和电子邮件地址会导致启动失败。ID 必须使用 Slack 的标准大写前缀和主体(例如 C0123456789 或 U0123456789);小写和短形似值会导致启动失败。企业版账户不能启用 dangerouslyAllowNameMatching。企业版账户可以设置全局 mentionPatterns.mode。企业版 mentionPatterns.allowIn 和 mentionPatterns.denyIn 条目使用 team:<team-id>:channel:<channel-id>;裸频道 ID 会导致启动失败,因为它们可能在不同工作区之间被复用。工作区安装保留现有的裸频道作用域提及模式行为。每个被接受的工作区都获得独立的路由、会话、转录、去重、历史和缓存身份,即使 Slack ID 重叠。在 message 流中,普通用户消息和用户撰写的 file_share 事件受支持;其他消息子类型会在授权或系统事件处理之前被拒绝。
企业版 DM 支持与工作区安装相同的 disabled、open、allowlist 和 pairing 策略。配对(pairing)审批存储为 team:<team-id>:user:<user-id>,且仅应用于来自该工作区的事件。显式账户 allowFrom 条目可以为组织级用户 ID 省略工作区,或包含工作区以将访问限制在单一工作区;频道和发送者策略继续适用于频道消息。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw