Manifest 和 scopes
OpenClaw 期望的 Slack 应用清单,按权限范围逐项列出,以及用于扩展它的可选设置。
清单与权限范围检查表¶
基础 Slack 应用清单在 Socket Mode 和 HTTP Request URLs 中相同。只有 settings 块(以及斜杠命令的 url)不同。
基础清单(Socket Mode 默认):
{
"display_information": {
"name": "OpenClaw",
"description": "Slack connector for OpenClaw"
},
"features": {
"bot_user": { "display_name": "OpenClaw", "always_online": true },
"app_home": {
"home_tab_enabled": true,
"messages_tab_enabled": true,
"messages_tab_read_only_enabled": false
},
"agent_view": {
"agent_description": "OpenClaw connects Slack Agent View conversations to OpenClaw agents.",
"suggested_prompts": [
{ "title": "What can you do?", "message": "What can you help me with?" },
{
"title": "Summarize this channel",
"message": "Summarize the recent activity in this channel."
},
{ "title": "Draft a reply", "message": "Help me draft a reply." }
]
},
"slash_commands": [
{
"command": "/openclaw",
"description": "Send a message to OpenClaw",
"should_escape": false
}
]
},
"oauth_config": {
"scopes": {
"bot": [
"app_mentions:read",
"assistant:write",
"channels:history",
"channels:read",
"chat:write",
"commands",
"emoji:read",
"files:read",
"files:write",
"groups:history",
"groups:read",
"im:history",
"im:read",
"im:write",
"mpim:history",
"mpim:read",
"mpim:write",
"pins:read",
"pins:write",
"reactions:read",
"reactions:write",
"usergroups:read",
"users:read"
]
}
},
"settings": {
"socket_mode_enabled": true,
"event_subscriptions": {
"bot_events": [
"app_home_opened",
"app_mention",
"app_context_changed",
"agent_session_stopped",
"agent_session_title_changed",
"channel_rename",
"member_joined_channel",
"member_left_channel",
"message.channels",
"message.groups",
"message.im",
"message.mpim",
"pin_added",
"pin_removed",
"reaction_added",
"reaction_removed"
]
}
}
}
对于 HTTP Request URLs 模式,将 settings 替换为 HTTP 变体,并为每个斜杠命令添加 url。需要公共 URL:
{
"features": {
"slash_commands": [
{
"command": "/openclaw",
"description": "Send a message to OpenClaw",
"should_escape": false,
"url": "https://gateway-host.example.com/slack/events"
}
]
},
"settings": {
"event_subscriptions": {
"request_url": "https://gateway-host.example.com/slack/events",
"bot_events": [
"app_home_opened",
"app_mention",
"app_context_changed",
"agent_session_stopped",
"agent_session_title_changed",
"channel_rename",
"member_joined_channel",
"member_left_channel",
"message.channels",
"message.groups",
"message.im",
"message.mpim",
"pin_added",
"pin_removed",
"reaction_added",
"reaction_removed"
]
},
"interactivity": {
"is_enabled": true,
"request_url": "https://gateway-host.example.com/slack/events",
"message_menu_options_url": "https://gateway-host.example.com/slack/events"
}
}
}
附加清单设置¶
显示用于扩展上述默认值的不同功能。
默认清单会启用 Slack App Home 的 Home 选项卡,并订阅 app_home_opened。当工作区成员打开 Home 选项卡时,OpenClaw 会使用 views.publish 发布一个安全的默认 Home 视图;其中不包含会话负载或私有配置。当启用单一斜杠命令模式时,命令提示会使用 channels.slack.slashCommand.name;使用原生命令或不使用斜杠命令的安装会省略该提示。Messages 选项卡仍保持启用,用于 Slack DM。新应用通过 features.agent_view、assistant:write 和 app_context_changed 使用 Slack Agent View。有关 OpenClaw 如何检测该体验并将每个可见根路由到其自己的会话,请参阅 Agent View 私信。
OpenClaw 控制 Slack 会话状态:轮次运行时为 processing,原生审批等待时为 suspended,完成时为 active。原生 Stop 按钮需要 agent_session_stopped 事件订阅,并像 /stop 一样中止运行,执行相同的授权检查。会话标题遵循 OpenClaw 会话显示名称;agent_session_title_changed 订阅允许用户重命名回传到 OpenClaw。
已经使用 features.assistant_view 的现有应用可以保留该功能设置。OpenClaw 会继续为这些安装处理 assistant_thread_started 和 assistant_thread_context_changed;请添加相同的会话事件订阅,用于 Stop 和标题同步。Slack 将 Assistant View 到 Agent View 的迁移设为不可逆,并要求用户之后强制刷新,因此在打算迁移整个工作区之前,不要替换现有应用中的 assistant_view。
可选原生斜杠命令
可以使用多个 [原生斜杠命令](messaging.md#commands-and-slash-behavior) 来替代单个已配置命令,并带有细微差别:
- 使用 `/agentstatus` 而不是 `/status`,因为 `/status` 命令是保留的。
- 一个 Slack 应用一次最多只能注册 25 个斜杠命令(Slack 平台限制)。
OpenClaw 会为已启用的原生命令注册处理器,但 Slack 清单条目仍由管理员管理,并且不会在运行时同步。请手动将 `/login` 添加到清单中;下面的示例包含它,而不是可选的 `/side` 别名,以保持 25 个命令。`/login` 可以在任何地方显示,但它只在私聊或 Web UI 中签发配对码。
将现有的 features.slash_commands 部分替换为可用命令的子集:
=== "Socket 模式(默认)"
```json
{
"slash_commands": [
{
"command": "/new",
"description": "Start a new session",
"usage_hint": "[model]"
},
{
"command": "/reset",
"description": "Reset the current session"
},
{
"command": "/compact",
"description": "Compact the session context",
"usage_hint": "[instructions]"
},
{
"command": "/stop",
"description": "Stop the current run"
},
{
"command": "/session",
"description": "Manage thread-binding expiry",
"usage_hint": "idle <duration|off> or max-age <duration|off>"
},
{
"command": "/think",
"description": "Set the thinking level",
"usage_hint": "<level>"
},
{
"command": "/verbose",
"description": "Toggle verbose output",
"usage_hint": "on|off|full"
},
{
"command": "/fast",
"description": "Show or set fast mode",
"usage_hint": "[status|on|off]"
},
{
"command": "/reasoning",
"description": "Toggle reasoning visibility",
"usage_hint": "[on|off|stream]"
},
{
"command": "/elevated",
"description": "Toggle elevated mode",
"usage_hint": "[on|off|ask|full]"
},
{
"command": "/exec",
"description": "Show or set exec defaults",
"usage_hint": "host=<auto|sandbox|gateway|node> security=<deny|allowlist|full> ask=<off|on-miss|always> node=<id>"
},
{
"command": "/approve",
"description": "Approve or deny pending approval requests",
"usage_hint": "<id> <decision>"
},
{
"command": "/model",
"description": "Show or set the model",
"usage_hint": "[name|#|status]"
},
{
"command": "/models",
"description": "List providers/models",
"usage_hint": "[provider] [page] [limit=<n>|size=<n>|all]"
},
{
"command": "/help",
"description": "Show the short help summary"
},
{
"command": "/commands",
"description": "Show the generated command catalog"
},
{
"command": "/tools",
"description": "Show what the current agent can use right now",
"usage_hint": "[compact|verbose]"
},
{
"command": "/agentstatus",
"description": "Show runtime status, including provider usage/quota when available"
},
{
"command": "/context",
"description": "Explain how context is assembled",
"usage_hint": "[list|detail|json]"
},
{
"command": "/whoami",
"description": "Show your sender identity"
},
{
"command": "/skill",
"description": "Run a skill by name",
"usage_hint": "<name> [input]"
},
{
"command": "/btw",
"description": "Ask a side question without changing session context",
"usage_hint": "<question>"
},
{
"command": "/login",
"description": "Pair Codex login",
"usage_hint": "[codex|openai]"
},
{
"command": "/usage",
"description": "Control the usage footer or show cost summary",
"usage_hint": "off|tokens|full|cost"
}
]
}
```
=== "HTTP 请求 URL"
使用与上方 Socket 模式相同的 `slash_commands` 列表,并为每个条目添加 `"url": "https://gateway-host.example.com/slack/events"`。示例:
```json
{
"slash_commands": [
{
"command": "/new",
"description": "Start a new session",
"usage_hint": "[model]",
"url": "https://gateway-host.example.com/slack/events"
},
{
"command": "/help",
"description": "Show the short help summary",
"url": "https://gateway-host.example.com/slack/events"
}
]
}
```
在列表中的每个命令上重复该 `url` 值。
可选的作者身份权限范围(写操作)
如果你希望出站消息使用当前代理身份(自定义用户名和图标),而不是默认的 Slack 应用身份,请添加 chat:write.customize 机器人权限范围。
如果你使用表情图标,Slack 期望使用 :emoji_name: 语法。
可选的用户令牌权限范围(读操作)
如果你配置了 channels.slack.userToken,典型的读权限范围包括:
channels:history,groups:history,im:history,mpim:historychannels:read,groups:read,im:read,mpim:readusers:readreactions:readpins:reademoji:readsearch:read(如果你依赖 Slack 搜索读取)
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw