← Back to Skills Marketplace
onlyloveher

DingTalk CLI Auto

by onlyloveher · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
83
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install dingtalk-cli-auto
Description
基于钉钉官方CLI工具dws,实现消息发送、日程管理、待办事项、通讯录查询及机器人消息自动化操作。
README (SKILL.md)

DingTalk CLI Auto Skill

钉钉 CLI 自动化技能 - 基于钉钉官方 CLI 工具 (dws) 实现企业自动化功能。

Description

本 Skill 封装了钉钉官方 CLI 工具 dws (DingTalk Workspace CLI),提供以下企业自动化能力:

  • 📨 消息管理: 发送文本/Markdown消息给联系人或群聊
  • 📅 日程管理: 创建日程、查询空闲时段、查看日程列表
  • 待办事项: 创建、完成、删除、查询待办
  • 👥 通讯录: 搜索联系人、查询部门成员
  • 🤖 机器人交互: 发送群机器人消息

Prerequisites

1. 安装 dws CLI

# Linux/macOS
curl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.sh | sh

# Windows PowerShell
irm https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.ps1 | iex

2. 钉钉开放平台配置

  1. 访问 钉钉开放平台 创建企业内部应用
  2. 获取 AppKeyAppSecret
  3. 配置应用权限:
    • 通讯录管理
    • 日程管理
    • 待办管理
    • 群机器人消息
  4. 发布应用

3. 环境变量配置

export DWS_CLIENT_ID="your-app-key"
export DWS_CLIENT_SECRET="your-app-secret"

或使用 OpenClaw 环境配置:

openclaw config set dingtalk.app_key your-app-key
openclaw config set dingtalk.app_secret your-app-secret

4. 首次认证

dws auth login

按提示完成 OAuth 设备流认证。

Tools

发送消息

send_text_message

发送文本消息给指定用户或群聊

# 给用户发送消息
node scripts/message.js send-text --user-id "user123" --content "Hello, this is a test message"

# 给群聊发送消息
node scripts/message.js send-text --chat-id "chat123" --content "Group notification"

send_markdown_message

发送 Markdown 格式消息

node scripts/message.js send-md --user-id "user123" --title "通知" --content "**重要提醒**:会议即将开始"

日程管理

create_schedule

创建日程/会议

node scripts/calendar.js create \
  --title "周例会" \
  --start "2026-04-03T14:00:00" \
  --end "2026-04-03T15:00:00" \
  --attendees "user1,user2,user3" \
  --location "会议室A"

list_schedules

查询日程列表

# 查询今天的日程
node scripts/calendar.js list --today

# 查询指定日期范围
node scripts/calendar.js list --start "2026-04-01" --end "2026-04-07"

check_free_busy

查询用户空闲时间

node scripts/calendar.js free-busy \
  --users "user1,user2" \
  --start "2026-04-03T09:00:00" \
  --end "2026-04-03T18:00:00"

待办事项

create_todo

创建待办事项

node scripts/todo.js create \
  --content "完成项目文档" \
  --due "2026-04-05T18:00:00" \
  --assignees "user1"

list_todos

查询待办列表

# 所有待办
node scripts/todo.js list

# 即将到期的待办
node scripts/todo.js list --due-within 3

complete_todo

完成待办

node scripts/todo.js complete --id "todo123"

delete_todo

删除待办

node scripts/todo.js delete --id "todo123"

通讯录

search_contacts

搜索联系人

# 按姓名搜索
node scripts/contact.js search --name "张三"

# 按部门搜索
node scripts/contact.js search --dept "技术部"

get_department_members

获取部门成员列表

node scripts/contact.js dept-members --dept-id "dept123"

机器人消息

send_robot_message

发送群机器人消息

node scripts/robot.js send \
  --webhook "https://oapi.dingtalk.com/robot/send?access_token=xxx" \
  --secret "SECxxx" \
  --content "机器人通知消息"

Usage Examples

场景 1: 每日待办提醒

# 获取今日待办
node scripts/todo.js list --today

# 创建今日待办
node scripts/todo.js create --content "提交日报" --due "today 18:00"

场景 2: 会议通知

# 搜索参会人员
node scripts/contact.js search --name "张三"

# 检查空闲时间
node scripts/calendar.js free-busy --users "user1,user2" --duration 60

# 创建会议
node scripts/calendar.js create \
  --title "项目评审会" \
  --start "2026-04-03T14:00:00" \
  --duration 60 \
  --attendees "user1,user2"

# 发送会议提醒
node scripts/message.js send-md \
  --chat-id "chat123" \
  --title "会议提醒" \
  --content "**项目评审会** 将于14:00开始,请准时参加"

场景 3: 任务分派

# 查找成员
node scripts/contact.js search --name "李四"

# 创建并分派待办
node scripts/todo.js create \
  --content "完成API文档编写" \
  --assignees "user2" \
  --due "2026-04-05"

# 发送通知
node scripts/message.js send-text \
  --user-id "user2" \
  --content "你有一个新的待办任务:完成API文档编写,截止2026-04-05"

API Reference

命令行参数规范

所有脚本遵循统一的参数规范:

参数 说明 示例
--user-id 用户ID user123
--chat-id 群聊ID chat456
--content 消息/内容 Hello World
--title 标题 会议通知
--start 开始时间 2026-04-03T14:00:00
--end 结束时间 2026-04-03T15:00:00
--duration 持续时间(分钟) 60
--attendees 参会人(逗号分隔) user1,user2
--assignees 负责人(逗号分隔) user1
--due 截止日期 2026-04-05today
--dept-id 部门ID dept123
--name 姓名 张三
--dept 部门名称 技术部
--webhook 机器人Webhook https://...
--secret 机器人密钥 SEC...

时间格式

  • ISO 8601: 2026-04-03T14:00:00
  • 相对时间: today, tomorrow, +3d (3天后)
  • 自然语言: 今天18:00, 明天上午9点

Error Handling

常见错误

错误码 说明 解决方案
401 未认证或Token过期 执行 dws auth login
403 权限不足 检查应用权限配置
404 用户/群聊不存在 检查ID是否正确
400 参数错误 检查参数格式
429 请求过于频繁 稍后重试

调试模式

添加 --debug 参数查看详细日志:

node scripts/message.js send-text --user-id "user123" --content "test" --debug

Configuration

OpenClaw 集成配置

在 OpenClaw 配置文件中添加:

{
  "skills": {
    "dingtalk-cli-auto": {
      "app_key": "your-app-key",
      "app_secret": "your-app-secret",
      "default_chat_id": "your-default-chat-id"
    }
  }
}

环境变量

变量名 说明 必需
DWS_CLIENT_ID 钉钉AppKey
DWS_CLIENT_SECRET 钉钉AppSecret
DINGTALK_DEFAULT_CHAT 默认群聊ID
DINGTALK_DEBUG 调试模式

Dependencies

  • Node.js >= 18.0.0
  • dws CLI >= 0.5.0

Installation

# 克隆到技能目录
cd ~/clawd/skills
git clone \x3Crepo-url> dingtalk-cli-auto

# 安装依赖
cd dingtalk-cli-auto
npm install

# 配置认证
export DWS_CLIENT_ID="your-app-key"
export DWS_CLIENT_SECRET="your-app-secret"
dws auth login

# 测试
npm test

Testing

运行测试用例:

# 全部测试
npm test

# 单模块测试
npm run test:message
npm run test:calendar
npm run test:todo
npm run test:contact

Troubleshooting

问题:dws 命令未找到

解决方案

# 确认安装路径
which dws

# 添加到 PATH
export PATH="$HOME/.local/bin:$PATH"

# 重新安装
curl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.sh | sh

问题:认证失败

解决方案

# 清除缓存重新认证
dws auth logout
dws auth login

# 检查环境变量
echo $DWS_CLIENT_ID
echo $DWS_CLIENT_SECRET

问题:权限不足

解决方案

  1. 检查钉钉开放平台应用权限设置
  2. 确认应用已发布
  3. 确认用户在企业通讯录中

Changelog

v1.0.0 (2026-04-02)

  • 初始版本发布
  • 支持消息发送、日程管理、待办事项、通讯录查询
  • 支持机器人消息发送

License

MIT

Credits

Usage Guidance
This skill appears to be a straightforward wrapper around the DingTalk 'dws' CLI and the included Node modules are readable and not obfuscated. However: 1) The registry metadata is inconsistent — SKILL.md and code require the dws CLI and DWS_CLIENT_ID/DWS_CLIENT_SECRET but the skill metadata lists none. Expect to provide your DingTalk app key/secret. 2) SKILL.md recommends installing dws by piping a remote script from a GitHub raw URL (curl | sh / irm | iex). Do NOT run that without inspecting the install.sh / install.ps1 contents and verifying the repository is trustworthy. 3) Before installing, verify the dws installer URL and the dws project ownership; prefer installing dws from the official vendor page or trusted package manager if available. 4) Run this skill in an isolated or test environment first (or a container) and review package.json/package-lock for dependencies. 5) If you provide AppKey/AppSecret, ensure they have minimal necessary permissions and rotate them if you stop using the skill. If you want, I can: (a) fetch and summarise the referenced install.sh/install.ps1 contents, (b) point out exactly where to set environment variables in OpenClaw config, or (c) highlight every place in the code that uses credentials/execSync for a focused review.
Capability Assessment
Purpose & Capability
The skill implements wrappers around the DingTalk 'dws' CLI for messages, calendar, todos, contacts and robot webhooks — this is coherent with its name/description. However the registry metadata claims no required env vars or binaries while SKILL.md and the code clearly require the dws CLI and DWS_CLIENT_ID / DWS_CLIENT_SECRET. That metadata mismatch is unexpected.
Instruction Scope
SKILL.md confines runtime actions to installing dws, setting DingTalk app credentials, running dws auth and invoking included node scripts. The scripts call dws (via child_process.execSync) and send webhook requests only when the user supplies a webhook. Instructions do not attempt to read unrelated system files or exfiltrate data in the codebase. The only scope concern: SKILL.md tells users to pipe a remote install script into sh/iex which has broader runtime impact until you inspect it.
Install Mechanism
The package registry lists no install spec but SKILL.md instructs installing the dws CLI by piping a script from a raw GitHub URL (curl | sh or irm | iex). While GitHub raw is a common host, piping and executing remote install scripts is higher risk and should be reviewed before running. The skill itself includes package.json and Node code that require npm install — there is no platform install spec in metadata, which is an inconsistency.
Credentials
The code and documentation require DWS_CLIENT_ID and DWS_CLIENT_SECRET (and optionally DINGTALK_DEFAULT_CHAT / DINGTALK_DEBUG). The registry metadata omitted these required env vars and declared no primary credential. Requesting the DingTalk app key/secret is proportionate to the skill's purpose, but the omission from declared metadata is a packaging/information problem and increases risk because users may not realize which secrets are needed.
Persistence & Privilege
The skill does not request always:true, does not modify other skills, and does not require persistent elevated privileges. It runs as a normal skill and calls local dws CLI and axios for webhooks when invoked.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install dingtalk-cli-auto
  3. After installation, invoke the skill by name or use /dingtalk-cli-auto
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: support message sending, calendar management, todo, contacts, robot
Metadata
Slug dingtalk-cli-auto
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is DingTalk CLI Auto?

基于钉钉官方CLI工具dws,实现消息发送、日程管理、待办事项、通讯录查询及机器人消息自动化操作。 It is an AI Agent Skill for Claude Code / OpenClaw, with 83 downloads so far.

How do I install DingTalk CLI Auto?

Run "/install dingtalk-cli-auto" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is DingTalk CLI Auto free?

Yes, DingTalk CLI Auto is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does DingTalk CLI Auto support?

DingTalk CLI Auto is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created DingTalk CLI Auto?

It is built and maintained by onlyloveher (@onlyloveher); the current version is v1.0.0.

💬 Comments