Loading...
Loading...
Use DingTalk Workspace CLI (dws) to manage DingTalk contacts, calendar, todos, attendance, approvals, and more from the command line or AI agent workflows.
npx skill4agent add aradotso/trending-skills dingtalk-workspace-cliSkill by ara.so — Daily 2026 Skills collection.
dwscurl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.sh | shirm https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.ps1 | iex~/.local/bin~/.agents/skills/dwsexport PATH="$HOME/.local/bin:$PATH"
# Add to ~/.bashrc or ~/.zshrc to persistgit clone https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli.git
cd dingtalk-workspace-cli
make build
./dws versionhttp://127.0.0.1# Via CLI flags
dws auth login --client-id $DWS_CLIENT_ID --client-secret $DWS_CLIENT_SECRET
# Or set env vars first, then login
export DWS_CLIENT_ID=your-app-key
export DWS_CLIENT_SECRET=your-app-secret
dws auth login| Variable | Purpose |
|---|---|
| OAuth Client ID (DingTalk AppKey) |
| OAuth Client Secret (DingTalk AppSecret) |
| Override default config directory |
| Custom server registry endpoint |
| Comma-separated domains for bearer token (default: |
| Set to |
dws auth login # Authenticate via OAuth device flow
dws auth logout # Remove stored credentials
dws auth status # Show current auth status# Search users
dws contact user search --keyword "Alice"
# List departments
dws contact department list
# Get user details
dws contact user get --user-id <userId># List events
dws calendar event list
# Create an event
dws calendar event create \
--title "Q2 Planning" \
--start "2026-04-01T10:00:00+08:00" \
--end "2026-04-01T11:00:00+08:00" \
--attendees "<userId1>,<userId2>"
# Check room availability
dws calendar room list# List tasks
dws todo task list
# Create a task
dws todo task create \
--title "Prepare quarterly report" \
--executors "<userId>"
# Complete a task
dws todo task complete --task-id <taskId># List groups
dws chat group list
# Send a message via webhook
dws chat webhook send \
--url $DINGTALK_WEBHOOK_URL \
--content "Deployment succeeded ✅"
# Send robot message
dws chat robot send \
--group-id <groupId> \
--content "Hello from dws"# Get attendance records
dws attendance record list --user-id <userId> --date "2026-03-01"
# List shift schedules
dws attendance shift list# List approval templates
dws approval template list
# Submit an approval instance
dws approval instance create \
--process-code <processCode> \
--form-values '{"key":"value"}'
# Query approval instances
dws approval instance list --status RUNNING# Send a DING message
dws ding send --receiver-ids "<userId>" --content "Urgent: please review PR"
# Recall a DING message
dws ding recall --ding-id <dingId># List tables
dws aitable table list --space-id <spaceId>
# Query records
dws aitable record list --table-id <tableId># Search DingTalk open platform docs
dws devdoc search --keyword "webhook"# List workbench apps
dws workbench app list-f--format# Human-readable table (default)
dws contact user search --keyword "Alice" -f table
# Structured JSON (for agents and piping)
dws contact user search --keyword "Alice" -f json
# Raw API response
dws contact user search --keyword "Alice" -f rawdws contact user search --keyword "Alice" -f json -o results.jsondws todo task list --dry-run
dws calendar event create --title "Test" --dry-run# Bash
dws completion bash > /etc/bash_completion.d/dws
# Zsh
dws completion zsh > "${fpath[1]}/_dws"
# Fish
dws completion fish > ~/.config/fish/completions/dws.fish| Code | Category | Meaning |
|---|---|---|
| 0 | Success | Command completed successfully |
| 1 | API | MCP tool call or upstream API failure |
| 2 | Auth | Authentication or authorization failure |
| 3 | Validation | Bad input flags or schema mismatch |
| 4 | Discovery | Service discovery or cache failure |
| 5 | Internal | Unexpected internal error |
-f jsoncategoryreasonhintactions#!/bin/bash
set -euo pipefail
# Search for user and extract userId
USER_ID=$(dws contact user search --keyword "Alice" -f json | \
jq -r '.data[0].userId')
echo "Found user: $USER_ID"
# Create a todo assigned to that user
dws todo task create \
--title "Review design doc" \
--executors "$USER_ID" \
-f json#!/bin/bash
dws ding send \
--receiver-ids "$TEAM_USER_IDS" \
--content "🕘 Daily standup in 5 minutes — please join!" \
-f json#!/bin/bash
STATUS=${1:-"unknown"}
EMOJI=$([[ "$STATUS" == "success" ]] && echo "✅" || echo "❌")
dws chat webhook send \
--url "$DINGTALK_WEBHOOK_URL" \
--content "$EMOJI Build #$BUILD_NUMBER $STATUS — $BUILD_URL"package main
import (
"os/exec"
"encoding/json"
"fmt"
)
type SearchResult struct {
Data []struct {
UserID string `json:"userId"`
Name string `json:"name"`
} `json:"data"`
}
func searchDingTalkUser(keyword string) (*SearchResult, error) {
cmd := exec.Command("dws", "contact", "user", "search",
"--keyword", keyword,
"-f", "json",
)
out, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("dws error: %w", err)
}
var result SearchResult
if err := json.Unmarshal(out, &result); err != nil {
return nil, err
}
return &result, nil
}
func main() {
result, err := searchDingTalkUser("Alice")
if err != nil {
panic(err)
}
for _, u := range result.Data {
fmt.Printf("User: %s (%s)\n", u.Name, u.UserID)
}
}dws.agents/skills/# Install to current working directory (project-scoped)
curl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install-skills.sh | sh./.agents/skills/dws/dwsMarket Registry → Discovery → IR (normalized catalog) → CLI (Cobra) → Transport (MCP JSON-RPC)
↓ ↓
mcp.dingtalk.com Disk cache (TTL + stale-fallback for offline use)mcp.dingtalk.commake build # Build binary
make test # Run unit tests
make lint # Format + lint
make package # Build all release artifacts locally (goreleaser snapshot)
make release # Build and release via goreleaserdws: command not foundexport PATH="$HOME/.local/bin:$PATH"DWS_CLIENT_IDDWS_CLIENT_SECREThttp://127.0.0.1dwsrm -rf "${DWS_CONFIG_DIR:-$HOME/.config/dws}/cache"DWS_SERVERS_URL# Get structured error details
dws todo task list -f json
# Response includes: category, reason, hint, actionsdws contact user search --keyword "Alice" -f rawexport DWS_ALLOW_HTTP_ENDPOINTS=1