返回顶部
d

dingtalk-openapi-skill钉钉开放API技能

Operate DingTalk messaging APIs through UXC with a curated OpenAPI schema, app-token bearer auth, and robot/service-group guardrails.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
185
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

dingtalk-openapi-skill

钉钉消息技能

使用此技能通过 uxc + OpenAPI 执行钉钉消息操作。

复用 uxc 技能以实现共享执行、认证和错误处理指导。

前提条件

  • - uxc 已安装并可在 PATH 中使用。
  • 可访问 https://api.dingtalk.com/v1.0 网络。
  • 可访问精选的 OpenAPI 模式 URL:
- https://raw.githubusercontent.com/holon-run/uxc/main/skills/dingtalk-openapi-skill/references/dingtalk-messaging.openapi.json
  • - 一个已启用机器人消息权限的钉钉内部应用或应用套件。
  • 钉钉应用的 appKey + appSecret,或当前 accessToken(如果使用手动回退路径)。
  • 目标发送流程所需的机器人编码、会话标识符和用户标识符。

范围

此技能涵盖一个狭窄的、专注于即时通讯的请求/响应接口:

  • - 一对一机器人发送
  • 群机器人发送
  • 服务群发送
  • 通过 unionId 进行最小化的用户查询

此技能涵盖:

  • - 审批、考勤、管理或更广泛的企业应用工作流
  • 旧的 oapi.dingtalk.com 端点
  • 自定义机器人 webhook 令牌/签名流程
  • 入站回调或 webhook 接收器运行时

订阅/流模式状态

钉钉具有事件传递流程(如流模式),但这些流程不在当前技能范围内。

当前 uxc subscribe 状态:

  • - 此技能仅针对请求/响应消息操作进行了验证
  • 钉钉入站事件/消息接收目前未通过 uxc subscribe 验证

将钉钉视为未来可能通过流模式支持的订阅目标,而非当前支持的即时通讯订阅提供者。

API 接口选择

此技能特意固定使用较新的钉钉开放平台主机:

  • - https://api.dingtalk.com/v1.0

较旧的 oapi.dingtalk.com 接口被有意排除在 v1 之外,以保持认证和模式结构的一致性。

认证

钉钉 v1 API 使用应用 accessToken 凭证。

首选设置是将 appKey + appSecret 存储为凭证字段,并让 uxc auth bootstrap 自动获取和刷新短期访问令牌。

Bootstrap 管理设置:

bash
uxc auth credential set dingtalk-app \
--auth-type bearer \
--field appkey=env:DINGTALKAPP_KEY \
--field appsecret=env:DINGTALKAPP_SECRET

uxc auth bootstrap set dingtalk-app \
--token-endpoint https://api.dingtalk.com/v1.0/oauth2/accessToken \
--header Content-Type=application/json \
--request-json {appKey:{{field:appkey}},appSecret:{{field:appsecret}}} \
--access-token-pointer /accessToken \
--expires-in-pointer /expireIn

uxc auth binding add \
--id dingtalk-app \
--host api.dingtalk.com \
--path-prefix /v1.0 \
--scheme https \
--credential dingtalk-app \
--priority 100

如果已有应用访问令牌,手动回退方式:

bash
curl -sS https://api.dingtalk.com/v1.0/oauth2/accessToken \
-H Content-Type: application/json \
-d {appKey:dingxxxx,appSecret:xxxx}

配置一个 bearer 凭证并将其绑定到钉钉 API 主机:

bash
uxc auth credential set dingtalk-app \
--auth-type bearer \
--secret-env DINGTALKACCESSTOKEN

uxc auth binding add \
--id dingtalk-app \
--host api.dingtalk.com \
--path-prefix /v1.0 \
--scheme https \
--credential dingtalk-app \
--priority 100

当认证看起来有问题时,验证活动映射:

bash
uxc auth binding match https://api.dingtalk.com/v1.0

核心工作流

  1. 1. 默认使用固定链接命令:
- command -v dingtalk-openapi-cli - 如果缺失,创建它: uxc link dingtalk-openapi-cli https://api.dingtalk.com/v1.0 --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/dingtalk-openapi-skill/references/dingtalk-messaging.openapi.json - dingtalk-openapi-cli -h
  1. 2. 首先检查操作模式:
- dingtalk-openapi-cli get:/contact/users/{unionId} -h - dingtalk-openapi-cli post:/robot/oToMessages/batchSend -h - dingtalk-openapi-cli post:/robot/groupMessages/send -h
  1. 3. 在写入操作前优先进行读取/设置验证:
- dingtalk-openapi-cli get:/contact/users/{unionId} unionId=$DINGTALKUNIONID - dingtalk-openapi-cli post:/robot/oToMessages/batchSend -h - dingtalk-openapi-cli post:/serviceGroup/messages/send -h
  1. 4. 使用键/值或位置 JSON 执行:
- 键/值: dingtalk-openapi-cli get:/contact/users/{unionId} unionId=$DINGTALKUNIONID language=zh_CN - 位置 JSON: dingtalk-openapi-cli post:/robot/groupMessages/send {openConversationId:cidxxxx,robotCode:dingxxxx,msgKey:sampleText,msgParam:{\content\:\Hello from UXC\}}

操作组

用户查询

  • - get:/contact/users/{unionId}

消息发送

  • - post:/robot/oToMessages/batchSend
  • post:/robot/groupMessages/send
  • post:/serviceGroup/messages/send

安全护栏

  • - 保持自动化在 JSON 输出信封上;不要使用 --text。
  • 首先解析稳定字段:ok、kind、protocol、data、error。
  • 优先使用 uxc auth bootstrap 而非手动令牌管理。手动 accessToken 设置仍作为回退方式支持。
  • 所有三个发送操作都是高风险写入操作。执行前需要明确的用户确认。
  • 钉钉 msgParam 是一个 JSON 编码的字符串负载,而非嵌套的 JSON 对象。在发送前仔细构建和验证该字符串。
  • robotCode、openConversationId、coolAppCode 和目标标识符都是特定于提供者的路由字段。即使认证有效,缺少其中任何一个通常也会导致发送失败。
  • 此 v1 封装不包括自定义机器人 webhook 令牌/签名流程;仅使用基于应用的 API。
  • dingtalk-openapi-cli ... 等同于 uxc https://api.dingtalk.com/v1.0 --schema-url openapischema> ...。

参考

  • - 使用模式:references/usage-patterns.md
  • 精选的 OpenAPI 模式:references/dingtalk-messaging.openapi.json
  • 钉钉开发者文档:https://open.dingtalk.com/document/

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 dingtalk-openapi-skill-1776065297 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 dingtalk-openapi-skill-1776065297 技能

通过命令行安装

skillhub install dingtalk-openapi-skill-1776065297

下载

⬇ 下载 dingtalk-openapi-skill v1.0.0(免费)

文件大小: 6.94 KB | 发布时间: 2026-4-15 12:30

v1.0.0 最新 2026-4-15 12:30
- Initial release of the DingTalk messaging skill for UXC.
- Provides request/response IM operations: one-to-one bot sends, group bot sends, service group sends, and minimal user lookup.
- Uses curated OpenAPI schema and DingTalk v1 API (`api.dingtalk.com/v1.0`) exclusively.
- App-token bearer authentication managed via `uxc auth bootstrap` or manual access token fallback.
- Includes guardrails for write operations and clear guidance for setup and execution.
- Excludes approval, admin, webhook, and subscribe/stream event flows.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部