Responsible for operations of the DingTalk Calendar API. This document is thestrategy guide; for the complete request format, see references/api.md。
dt_helper.shlocated in thisSKILL.mdsibling directory'sscripts/dt_helper.sh。
Core Concepts
- In the path,
userId: in the schedule API path/v1.0/calendar/users/{userId}/..., the{userId}is unionId(consistent with to-dos and documents), not staffId. - Primary calendar: the personal default calendar's
calendarIdis fixed to the stringprimary(lowercase). Create/query/list/update/delete all target.../calendars/primary/events...。 - Time format:
start/end, free/busystartTime/endTime, listtimeMin/timeMaxmust use UTC ISO8601 with milliseconds, for example2026-03-24T07:02:48.000Z. Omitting milliseconds easily triggersParsedISO8601TimestampError。 - Modify schedule: the HTTP method is PUT(the same path corresponding to the "partial update" semantics), and the request body must include the schedule
idand the fields to change (such assummary)。 - Video conference: when creating a schedule, add
"onlineMeetingInfo":{"type":"dingtalk"}to the request body; the response includesonlineMeetingInfo.url, etc. - Meeting room: first query by meeting room availability interface using
roomIds+ time window; then on an existing schedule add meeting room(requires the enterprise's meeting roomroomId, queryable in the admin console or open platform). For integration testing, the environment variableTEST_MEETING_ROOM_IDScan be used (comma-separated). - Check-in/check-out: after the schedule is created, you can GET check-in/check-out link and distribute it to attendees; organizers/participants POST check-in; for details use GET signin / signOut list interface (see api.md). Whether it links with offline meetings and approval flows is subject to DingTalk-side capabilities.
Scenario routing (classify first, then call the API)
| User intent | Preferred API direction |
|---|---|
| Book a meeting room, check whether a meeting room is available | POST .../meetingRooms/schedules/query |
| Add a meeting room to an existing schedule | POST .../events/{eventId}/meetingRooms |
| Want a check-in code, check-out link | GET .../signInLinks、GET .../signOutLinks |
| Repeat weekly, repeat daily | When creating a schedule, include recurrence(see api.md) |
| Only check people's free/busy status (not for meeting rooms) | POST .../querySchedule |
Workflow (before each execution)
- Identify the task → after classifying according to the table above, then select the specific API (see
references/api.md)。 - Validate configuration →
bash scripts/dt_helper.sh --getreadDINGTALK_APP_KEY、DINGTALK_APP_SECRET、DINGTALK_MY_USER_ID、DINGTALK_MY_OPERATOR_ID(when unionId is missing,--to-unionid)。 - Collect missing items → ask once and
--setwrite to~/.dingtalk-skills/config。 - Obtain a new-version Token →
NEW_TOKEN=$(bash scripts/dt_helper.sh --token), request headerx-acs-dingtalk-access-token。 - Execute the API → write multi-line logic to
/tmp/<task>.shthen execute; heredoc is prohibited.
Validate configuration by task
- General required:
DINGTALK_APP_KEY、DINGTALK_APP_SECRET、DINGTALK_MY_USER_ID; before calling, unionId(DINGTALK_MY_OPERATOR_IDis required or generated via--to-unionid).
The API must not be called before validation passes. Credentials are displayed as only the first 4 characters +
****。
Required configuration
| Configuration key | Required | Description |
|---|---|---|
DINGTALK_APP_KEY |
✅ | Client ID(AppKey) |
DINGTALK_APP_SECRET |
✅ | Client Secret |
DINGTALK_MY_USER_ID |
✅ | Current user userId (admin console contacts) |
DINGTALK_MY_OPERATOR_ID |
✅ | Current user unionId (--to-unionid can be written) |
Identity identifier description
| Identifier | Description |
|---|---|
userId |
Enterprise employee ID, visible in the admin console |
unionId |
Both the calendar path parameters and the user identifiers in the body use unionId |
userId → unionId: useLegacy version access_token call POST https://oapi.dingtalk.com/topapi/v2/user/get(see references/api.md), take result.unionid(no underscore).
Execution script template
#!/bin/bash
set -e
HELPER="./scripts/dt_helper.sh"
NEW_TOKEN=$(bash "$HELPER" --token)
UNION_ID=$(bash "$HELPER" --get DINGTALK_MY_OPERATOR_ID)
CAL_ID="primary"
curl -s -X POST "https://api.dingtalk.com/v1.0/calendar/users/${UNION_ID}/calendars/${CAL_ID}/events" \
-H "x-acs-dingtalk-access-token: $NEW_TOKEN" \
-H "Content-Type: application/json" \
-d '{"summary":"周会","start":{"dateTime":"2026-03-25T02:00:00.000Z","timeZone":"UTC"},"end":{"dateTime":"2026-03-25T03:00:00.000Z","timeZone":"UTC"}}'
When Token is abnormal:
bash "$HELPER" --token --nocache
references/api.md lookup index
grep -A 35 "^## 1. 创建日程" references/api.md
grep -A 25 "^## 2. 查询单个日程" references/api.md
grep -A 30 "^## 3. 查询日程列表" references/api.md
grep -A 25 "^## 4. 更新日程" references/api.md
grep -A 15 "^## 5. 删除日程" references/api.md
grep -A 28 "^## 6. 查询闲忙" references/api.md
grep -A 22 "^## 7. 视频会议" references/api.md
grep -A 28 "^## 8. 查询会议室忙闲" references/api.md
grep -A 25 "^## 9. 添加与移除会议室" references/api.md
grep -A 18 "^## 10. 签到与签退链接" references/api.md
grep -A 22 "^## 11. 签到与签退详情列表" references/api.md
grep -A 18 "^## 12. 签到与签退操作" references/api.md
grep -A 35 "^## 13. 循环日程" references/api.md
grep -A 15 "^## 14. 订阅日历" references/api.md
grep -A 15 "^## 错误码" references/api.md
grep -A 18 "^## 所需应用权限" references/api.md