卡片和操作
OpenClaw 发送到 Teams 的 Adaptive Card 界面、基于 Graph 的名册查找,以及用于寻址它们的目标格式。
成员信息操作¶
OpenClaw 为 Microsoft Teams 提供一个基于 Graph 的 member-info 操作,以便代理和自动化能够解析已配置会话的已验证名册详情。
要求:
ChannelSettings.Read.Group和TeamMember.Read.GroupRSC 权限(已包含在推荐清单中)。
只要配置了 Graph 凭据,该操作即可用;没有单独的 channels.msteams.actions.memberInfo 开关。
标准频道查找会返回匹配的团队名册身份、显示名称、电子邮件和角色。
在当前 DM 或群聊中,该操作可以返回可信发送者的稳定用户 ID。
私有/共享频道以及非当前聊天的成员查找需要额外的名册权限,
并且会被默认权限基线拒绝。
对于 message 工具中的 member-info 和 search,使用 channelId 选择会话。Graph 的 <team-id>/<channel-id> 形式用于标识 Teams 频道:
{
action: "member-info",
channel: "msteams",
channelId: "<team-id>/<channel-id>",
userId: "<user-id>",
}
search 使用相同的 channelId 过滤器,并用 query 代替 userId。
省略该过滤器时,如果当前会话的 Graph 路由可用,则使用当前会话。对于当前频道,其裸 19:...@thread.tacv2 ID 和
conversation:19:...@thread.tacv2 形式会复用同一 Graph 路由。使用完整的
Graph 形式来选择其他频道。所选会话仍须满足已配置的访问策略以及该操作的成员资格需求。
原生审批卡片¶
Microsoft Teams 可以在源会话中以 Adaptive Cards 形式投递 exec 和插件审批请求。每张卡片描述所请求的命令或插件操作,并且只提供该请求允许的决策,例如 批准一次、始终允许 和 拒绝。在做出决策或过期后,OpenClaw 会用最终状态更新原始卡片。
为你希望接收的每种审批类型启用现有的顶层审批转发设置:
{
approvals: {
exec: { enabled: true, mode: "session" },
plugin: { enabled: true, mode: "session" },
},
channels: {
msteams: {
allowFrom: ["00000000-0000-0000-0000-000000000000"],
},
},
}
approvals.exec 和 approvals.plugin 相互独立;启用其中一个不会启用另一个。原生卡片投递还要求已配置 Teams 机器人,并且至少有一个审批者从 channels.msteams.allowFrom 或 channels.msteams.defaultTo 解析得到。审批者必须是稳定的 AAD 对象 ID;显示名称、电子邮件地址、组条目和会话 ID 不会授予审批访问权限。OpenClaw 在解析请求之前会检查点击用户的 AAD 对象 ID。
无需 Teams 特定的审批配置。当原生投递不可用时,现有的 /approve <id> <decision> 命令仍可作为文本回退方案使用。有关转发模式和受支持的决策,请参阅 审批转发到聊天频道。
投票(Adaptive Cards)¶
OpenClaw 以 Adaptive Cards 形式发送 Teams 投票(没有原生的 Teams 投票 API)。
- CLI:
openclaw message poll --channel msteams --target conversation:<id> --poll-question "..." --poll-option "..." --poll-option "..."。 - 投票由网关记录在 OpenClaw 插件状态 SQLite 中,位于
state/openclaw.sqlite。 - 对于现有的
msteams-polls.json文件,在升级到最新版本之前,请在 2026.9.5 上运行openclaw doctor --fix。请参阅 升级非常旧的版本。 - 网关必须保持在线以记录投票。
- 投票不会自动发布结果摘要,也没有 poll-results CLI。
撤销计划作业的消息权限会停止尚未提交的投票。 已提交到 Teams 的投票在运行完成期间会保留其已接受的 ID 和正常投票跟踪。
展示卡片¶
使用 message 工具、CLI 或常规回复投递,向 Teams 用户或会话发送语义展示负载。OpenClaw 会根据通用展示契约将它们渲染为 Teams Adaptive Cards。
presentation 参数接受语义块。提供 presentation 时,消息文本是可选的。按钮会渲染为 Adaptive Card 提交或 URL 操作。Teams 渲染器不支持原生的选择菜单,因此 OpenClaw 会在投递前将其降级为可读文本。
Agent 工具:
{
action: "send",
channel: "msteams",
target: "user:<id>",
presentation: {
title: "Hello",
blocks: [{ type: "text", text: "Hello!" }],
},
}
CLI:
openclaw message send --channel msteams \
--target "conversation:19:abc...@thread.tacv2" \
--presentation '{"title":"Hello","blocks":[{"type":"text","text":"Hello!"}]}'
有关目标格式的详细信息,请参阅下文中的 目标格式。
目标格式¶
MSTeams 目标使用前缀来区分用户和会话:
| 目标类型 | 格式 | 示例 |
|---|---|---|
| 用户(按 ID) | user:<aad-object-id> |
user:40a1a0ed-4ff2-4164-a219-55518990c197 |
| 用户(按名称) | user:<display-name> |
user:John Smith(需要 Graph API) |
| 群组/频道 | conversation:<conversation-id> |
conversation:19:abc123...@thread.tacv2 |
| 目标类型 | 格式 | 示例 |
|---|---|---|
| 群组/频道(原始) | <conversation-id> |
19:abc123...@thread.tacv2、19:...@unq.gbl.spaces,或裸的 a:/8:orgid:/29: Bot Framework id |
CLI 示例:
# Send to a user by ID
openclaw message send --channel msteams --target "user:40a1a0ed-..." --message "Hello"
# Send to a user by display name (triggers Graph API lookup)
openclaw message send --channel msteams --target "user:John Smith" --message "Hello"
# Send to a group chat or channel
openclaw message send --channel msteams --target "conversation:19:abc...@thread.tacv2" --message "Hello"
# Send a presentation card to a conversation
openclaw message send --channel msteams --target "conversation:19:abc...@thread.tacv2" \
--presentation '{"title":"Hello","blocks":[{"type":"text","text":"Hello"}]}'
Agent 工具示例:
{
action: "send",
channel: "msteams",
target: "conversation:19:abc...@thread.tacv2",
presentation: {
title: "Hello",
blocks: [{ type: "text", text: "Hello" }],
},
}
Note
如果没有 user: 前缀,名称默认按群组或团队解析。按显示名称定位人员时,始终使用 user:。
主动消息¶
- 主动消息只能在用户交互之后发送,因为 OpenClaw 会在该时点存储会话引用。
- 有关
dmPolicy和允许列表门控,请参阅 /gateway/configuration。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 cl/openclaw