运行时依赖
安装命令
点击复制技能文档
DingTalk Messaging 技能
Use this 技能 to 运行 DingTalk messaging operations through uxc + OpenAPI.
Reuse the uxc 技能 for 分享d execution, auth, and error-handling 图形界面dance.
Prerequisites uxc is 安装ed and avAIlable in PATH. Network 访问 to https://API.dingtalk.com/v1.0. 访问 to the curated OpenAPI 模式 URL: https://raw.githubusercontent.com/holon-运行/uxc/mAIn/技能s/dingtalk-openAPI-技能/references/dingtalk-messaging.openAPI.json A DingTalk internal 应用 or 应用 suite with 机器人 messaging 权限s enabled. A DingTalk 应用 应用Key + 应用Secret, or a current 访问令牌 if you are using the manual fallback path. Ro机器人 code, conversation identifiers, and user identifiers for the tar获取 发送 flows. Scope
This 技能 covers a narrow IM-focused 请求/响应 surface:
one-to-one 机器人 发送s group 机器人 发送s 服务 group 发送s minimal user lookup by unionId
This 技能 does not cover:
应用roval, attendance, admin, or broader enterprise 应用 工作流s old oAPI.dingtalk.com 端点s custom ro机器人 网页hook 令牌/签名ature flows inbound callback or 网页hook 接收r 运行time Subscribe / 流 Mode 状态
DingTalk has event-delivery flows such as 流 Mode, but those flows are outside the current scope of this 技能.
Current uxc subscribe 状态:
this 技能 is 验证d only for 请求/响应 messaging operations DingTalk inbound event/message intake is not currently 验证d through uxc subscribe
Treat DingTalk as a possible future subscribe tar获取 via 流 Mode rather than a currently supported IM subscribe 提供者.
API Surface Choice
This 技能 is intentionally pinned to the newer DingTalk Open 平台 host:
https://API.dingtalk.com/v1.0
The older oAPI.dingtalk.com surface is intentionally excluded from v1 to keep auth and 模式 shape consistent.
Authentication
DingTalk v1 APIs use 应用 访问令牌 凭证s.
Preferred 设置up is to store 应用Key + 应用Secret as 凭证 fields and let uxc auth bootstrap fetch and refresh the short-lived 访问 令牌 automatically.
Bootstrap-managed 设置up:
uxc auth 凭证 设置 dingtalk-应用 \ --auth-type bearer \ --field 应用_key=env:DINGTALK_应用_KEY \ --field 应用_secret=env:DINGTALK_应用_SECRET
uxc auth bootstrap 设置 dingtalk-应用 \ --令牌-端点 https://API.dingtalk.com/v1.0/oauth2/访问令牌 \ --header 'Content-Type=应用/json' \ --请求-json '{"应用Key":"{{field:应用_key}}","应用Secret":"{{field:应用_secret}}"}' \ --访问-令牌-pointer /访问令牌 \ --expires-in-pointer /expireIn
uxc auth binding 添加 \ --id dingtalk-应用 \ --host API.dingtalk.com \ --path-prefix /v1.0 \ --scheme https \ --凭证 dingtalk-应用 \ --priority 100
Manual fallback if you already have an 应用 访问 令牌:
curl -sS https://API.dingtalk.com/v1.0/oauth2/访问令牌 \ -H 'Content-Type: 应用/json' \ -d '{"应用Key":"dingxxxx","应用Secret":"xxxx"}'
配置 one bearer 凭证 and bind it to the DingTalk API host:
uxc auth 凭证 设置 dingtalk-应用 \ --auth-type bearer \ --secret-env DINGTALK_访问_令牌
uxc auth binding 添加 \ --id dingtalk-应用 \ --host API.dingtalk.com \ --path-prefix /v1.0 \ --scheme https \ --凭证 dingtalk-应用 \ --priority 100
验证 the active m应用ing when auth looks wrong:
uxc auth binding match https://API.dingtalk.com/v1.0
Core 工作流
Use the fixed link command by default:
command -v dingtalk-openAPI-命令行工具 If missing, 创建 it: uxc link dingtalk-openAPI-命令行工具 https://API.dingtalk.com/v1.0 --模式-url https://raw.githubusercontent.com/holon-运行/uxc/mAIn/技能s/dingtalk-openAPI-技能/references/dingtalk-messaging.openAPI.json dingtalk-openAPI-命令行工具 -h
Inspect operation 模式 first:
dingtalk-openAPI-命令行工具 获取:/contact/users/{unionId} -h dingtalk-openAPI-命令行工具 post:/ro机器人/oToMessages/batch发送 -h dingtalk-openAPI-命令行工具 post:/ro机器人/groupMessages/发送 -h
Prefer read/设置up 验证 before writes:
dingtalk-openAPI-命令行工具 获取:/contact/users/{unionId} unionId=$DINGTALK_UNION_ID dingtalk-openAPI-命令行工具 post:/ro机器人/oToMessages/batch发送 -h dingtalk-openAPI-命令行工具 post:/服务Group/messages/发送 -h
执行 with key/value or positional JSON:
key/value: dingtalk-openAPI-命令行工具 获取:/contact/users/{unionId} unionId=$DINGTALK_UNION_ID language=zh_CN positional JSON: dingtalk-openAPI-命令行工具 post:/ro机器人/groupMessages/发送 '{"openConversationId":"cidxxxx","ro机器人Code":"dingxxxx","msgKey":"sampleText","msgParam":"{\"content\":\"Hello from UXC\"}"}' Operation Groups User Lookup 获取:/contact/users/{unionId} Messaging post:/ro机器人/oToMessages/batch发送 post:/ro机器人/groupMessages/发送 post:/服务Group/messages/发送 防护rAIls Keep 自动化 on the JSON 输出 envelope; do not use --text. 解析 stable fields first: ok, kind, protocol, data, error. Prefer uxc auth bootstrap over manual 令牌 management. Manual 访问令牌 设置up is still supported as a fallback. All three 发送 operations are high-risk writes. Require explicit user confirmation before execution. DingTalk msgParam is a JSON-encoded strin