Use the dws CLI to interact with DingTalk enterprise workspace. This skill covers all 12 products: contact, chat, bot, calendar, todo, oa (approval), attendance, ding, report, aitable, workbench, and devdoc.
⚠️ Security & Safety Notes
Read before installing:
1. Credentials Required: This skill requires OAuth credentials (DWSCLIENTID, DWSCLIENTSECRET) from a DingTalk Open Platform app. Enterprise admin approval may be needed.
2. Install Safely: The dws CLI installer fetches from GitHub. Review the installer script before running:
3. Autonomous Execution Risk: This skill can perform destructive actions (approve workflows, send messages, delete records). Always use --dry-run first and restrict autonomous invocation unless you trust the agent.
4. Least Privilege: Use scoped OAuth credentials with minimum permissions. Test in a sandbox enterprise first.
Prerequisites
Installation
Option 1: Install from release (recommended)
Download pre-built binary from https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases
Option 2: Build from source (safer)
CODEBLOCK0
Option 3: Install script (review first!)
CODEBLOCK1
Authentication
CODEBLOCK2
Safe Execution Guidelines
For Agents
- --dry-run: ALWAYS use first for mutations to preview API calls
--yes: Skip confirmation prompts (use only after verifying with --dry-run)
--jq: Extract specific fields to reduce token consumption
--fields: Return only needed fields
Recommended Workflow
CODEBLOCK3
Auto-Correction
INLINECODE7 automatically corrects common AI mistakes:
Before making calls, discover available capabilities:
CODEBLOCK4
Quick Reference by Product
Contact
CODEBLOCK5
Chat
CODEBLOCK6
Calendar
CODEBLOCK7
Todo
CODEBLOCK8
Approval (OA)
CODEBLOCK9
Attendance
CODEBLOCK10
Report
CODEBLOCK11
AITable
CODEBLOCK12
Output Control
jq Filtering
CODEBLOCK13
Field Selection
CODEBLOCK14
File Input
CODEBLOCK15
Common Workflows
See bundled scripts in scripts/ for batch operations:
Script
Description
INLINECODE19
Create event + add participants + book meeting room
INLINECODE20
Find common free slots across multiple people |
| todo_batch_create.py | Batch create todos from JSON |
| contact_dept_members.py | Search department and list all members |
| report_inbox_today.py | View today's received reports |
Error Handling
Common Error Codes
- INVALID_TOKEN: Re-authenticate with INLINECODE25
INLINECODE26 : Check app permissions in DingTalk Open Platform
INLINECODE27 : Verify IDs with dws schema introspection
Recovery
When encountering RECOVERY_EVENT_ID, use:
CODEBLOCK16
Security Notes
- Credentials are stored encrypted in system Keychain (never in config files)
All requests use HTTPS to *.dingtalk.com only
Use --dry-run before any mutation to preview the API call
Token refresh is automatic; no manual intervention needed
Reference Files
- Product commands: See references/products/*.md for detailed command reference per product
Intent guide: See references/intent-guide.md for disambiguation (e.g., report vs todo)
Error codes: See references/error-codes.md for debugging workflows
Global reference: See references/global-reference.md for auth, output formats, global flags
- Added a dedicated security and safety section at the top, highlighting credential handling, installation review, and safe usage with destructive actions.
- Expanded installation instructions with multiple options (pre-built binaries, source build, install script) and emphasized reviewing installer scripts before use.
- Clarified OAuth credential requirements and placement for authentication.
- Strengthened safe execution instructions for agents, with explicit --dry-run use and a recommended step-by-step workflow.
- No API or functional changes to commands; documentation and guidance improved for safer, more secure ons.