SuperAPI AI Directory

dws-cli

Data & analytics

View repository

Updated 10-15 21:10

About this skill

DingTalk Full Product Skill (via dws CLI)

Via dws commands, manage DingTalk product capabilities. All commands are executed by openclaw in the terminal; the agent is responsible for generating the correct CLI commands.

Prerequisites

Before using this skill, confirm that the dws CLI is installed and authorized:

  1. Installation check: run dws --version, confirm version >= 1.0.6
  2. Authorization check: run dws auth status, confirm you are logged in
  3. Environment variables: the connector automatically injects the following environment variables at runtime; the dws CLI reads them automatically, so no manual setup is needed:
    • DWS_CHANNEL=openclaw — identifies the call source as the openclaw connector
    • DWS_CLIENT_ID=<clientId> — the Client ID of the current DingTalk app
    • DWS_CLIENT_SECRET=<clientSecret> — the Client Secret of the current DingTalk app

If the CLI is not installed or not authorized, guide the user to complete the corresponding steps (see the error handling section below for details).

Strictly prohibited (NEVER DO)

  • Do not operate by any means other than dws commands (curl, HTTP API, and browser are prohibited)
  • Do not fabricate identifiers such as UUIDs or IDs; they must be extracted from command output
  • Do not guess field names/parameter values; query and confirm before operating

Strict requirements (MUST DO)

  • All commands must include --format json to obtain parseable output
  • Dangerous operations must be confirmed with the user first; only add --yes after the user agrees, then execute
  • A single batch operation must not exceed 30 records
  • All commands muststrictly followthe parameter formats specified in the corresponding product reference documentation (e.g., if there are parameter values, at least one space must separate parameters and parameter values)

Product Overview

Product Purpose Reference File
aitable AI Tables: create/read/update/delete for tables/data tables/fields/records, template search aitable.md
approval Approval: approval forms/initiate instances/approve/cancel simple.md
attendance Attendance: clock-in records/shift queries attendance.md
calendar Calendar: events/participants/meeting rooms/free-busy queries calendar.md
chat Group Chat and Bots: search groups/create groups/group member management/rename group/bot group messaging/single chat/recall/Webhook/bot search chat.md
contact Contacts: user queries (current user/search/details)/department queries (search/sub-departments/member list) contact.md
devdoc Open Platform Documentation: search development docs simple.md
ding DING Messages: send/recall (in-app/SMS/phone) ding.md
report Logs: create by template/inbox/sent/template view/details/read statistics report.md
todo To-Dos: create (including priority/due time)/query/modify/mark complete/delete todo.md
workbench Workplace: app management workbench.md

Intent Determination Decision Tree

User mentions "table/multi-dimensional table/AI table/record/data" → aitable User mentions "approval/leave/reimbursement/business trip/overtime" → oa The user mentions "attendance/clock-in/shift scheduling" → attendance The user mentions "schedule/calendar/meeting room/appointment" → calendar The user mentions "group chat/create group/group members/group management/bot sends messages/Webhook/bot bulk messaging/bot one-on-one chat/notification" → chat The user mentions "contacts/colleagues/department/organization structure" → contact The user mentions "development/API/call error documentation" → devdoc The user mentions "DING/urgent message/phone reminder" → ding The user mentions "log/daily report/weekly report/log statistics/write daily report/submit weekly report/send log/fill in log" → report The user mentions "to-do/TODO/task reminder" → todo The user mentions "workbench/application management" → workbench

Key distinction: aitable (data table) vs todo (to-do task) Key distinction: report (DingTalk log/daily and weekly reports) vs todo (to-do task) Key distinction: chat send-by-bot (send messages as a bot) vs send-by-webhook (custom bot Webhook alert)

For more easily confused scenarios, see intent-guide.md

Confirmation for dangerous operations

The following operations are irreversible or high-impact operations; before execution,you must first show the user a summary of the operation and obtain explicit consent, and only after consent add --yes to execute.

Product Command Description
aitable base delete Delete the entire AI table, including all data tables and records
aitable record delete Delete records (batch supported)
calendar event delete Delete a schedule; all participants are canceled in sync
calendar participant delete Remove schedule participants
calendar room delete Cancel meeting room reservation
chat group members remove Remove group members
todo task delete Delete to-do

Confirmation process

Step 1 → 展示操作摘要(操作类型 + 目标对象 + 影响范围)
Step 2 → 用户明确回复确认(如 "确认" / "好的")
Step 3 → 加 --yes 执行命令

Core process

As an intelligent assistant, your primary task is tounderstand the user's true and complete intent, rather than simply executing commands. Before choosing the dws product command, you must strictly follow the following four-step process:

  1. Intent classification: First, determine which category the core verb/action of the user's instruction belongs to. This is more important than focusing on nouns.
  2. Ambiguity handling and information follow-up: If the user's instruction is vague or contains keywords for multiple products, guessing is strictly prohibited. You must proactively ask the user follow-up questions to clarify the intent. This is your core value as an intelligent assistant rather than a command executor.
  3. Precise product mapping: After completing the first two steps, once the intent is clear, refer to the product overview and intent determination decision tree to choose the product.
  4. Fully read the product reference files, and fulfill the user's intent by writing code or directly calling commands.

Error handling

CLI error signal identification and handling

Error signal Identification method Handling strategy
CLI not installed stderr contains "command not found: dws" Guide the user to install:npm i -g dingtalk-workspace-cli or curl -fsSL .../install.sh | sh
CLI not logged in stderr contains "please first execute dws login" or "dws auth login" Guide the user to execute dws auth login to complete OAuth QR code authorization
Token expired stderr contains "token expired" Prompt the user to re-execute dws auth login
Insufficient permissions stderr contains "permission denied" or HTTP 403 Prompt the user to contact the administrator to enable the corresponding permission
Recovery event stderr contains RECOVERY_EVENT_ID=<event_id> Follow recovery-guide.md to execute the recovery closed loop
Other errors Non-zero exit code + unrecognized stderr Add --verbose and retry once → if it still fails, report the full error information to the user

General error handling process

  1. When an error occurs, add --verbose and retry once
  2. If RECOVERY_EVENT_ID=<event_id>appears in stderr, preferentially follow recovery-guide.md to execute the recovery closed loop
  3. If it still fails, report the full error information to the user; do not attempt alternative solutions on your own
  4. When authentication fails, refer to the authentication section in global-reference.md for handling
  5. For high-frequency errors and troubleshooting processes for each product, see error-codes.md

Detailed reference (read as needed)