Loading...
Loading...
Compare original and translation side by side
位于本dt_helper.sh同级目录的SKILL.md。scripts/dt_helper.sh
is located indt_helper.shat the same level as thisscripts/dt_helper.sh.SKILL.md
bash scripts/dt_helper.sh --get KEYbash scripts/dt_helper.sh --set KEY=VALUEbash scripts/dt_helper.shbash scripts/dt_helper.sh --get KEYbash scripts/dt_helper.sh --set KEY=VALUEbash scripts/dt_helper.shDINGTALK_APP_KEYDINGTALK_APP_SECRETDINGTALK_MY_USER_ID规则:未通过“本次任务配置校验”前,不得进入 API 调用步骤。
凭证禁止在输出中完整打印,确认时仅显示前 4 位 +****
DINGTALK_APP_KEYDINGTALK_APP_SECRETDINGTALK_MY_USER_IDRule: Do not proceed to the API call step until the "task configuration validation" is passed.
Credentials are prohibited from being printed in full. Only display the first 4 characters +during confirmation.****
| 配置键 | 必填 | 说明 | 如何获取 |
|---|---|---|---|
| ✅ | 应用 AppKey | 钉钉开放平台 → 应用管理 → 凭证信息 |
| ✅ | 应用 AppSecret | 同上 |
| ❌ | 当前操作用户的 userId(即运行此技能的人自己),仅在需要以自身为起点查询时才需要 | 管理后台 → 通讯录 → 成员管理 → 点击姓名查看 |
| Configuration Key | Required | Description | How to Obtain |
|---|---|---|---|
| ✅ | AppKey of the application | DingTalk Open Platform → Application Management → Credential Information |
| ✅ | AppSecret of the application | Same as above |
| ❌ | userId of the current operator (the person running this skill), required only when querying starting from oneself | Admin Backend → Address Book → Member Management → Click name to view |
| 标识 | 说明 |
|---|---|
| 企业内部员工 ID,可通过通过管理后台 -> 通讯录 -> 成员管理 -> 点击姓名查看 |
| 跨企业/跨应用唯一标识,可通过 |
| Identifier | Description |
|---|---|
| Internal employee ID of the enterprise, which can be viewed via Admin Backend -> Address Book -> Member Management -> Click name |
| Unique identifier across enterprises/applications, which can be obtained via |
#!/bin/bash
set -e
HELPER="./scripts/dt_helper.sh"
NEW_TOKEN=$(bash "$HELPER" --token) # api.dingtalk.com 接口用
OLD_TOKEN=$(bash "$HELPER" --old-token) # oapi.dingtalk.com 接口用#!/bin/bash
set -e
HELPER="./scripts/dt_helper.sh"
NEW_TOKEN=$(bash "$HELPER" --token) # api.dingtalk.com 接口用
OLD_TOKEN=$(bash "$HELPER" --old-token) # oapi.dingtalk.com 接口用
> **Token 失效处理**:dt_helper 仅按时间缓存,无法感知 token 被提前吊销。若 API 返回 `errcode 40001`/`40014`(token 无效/过期),用 `--nocache` 跳过缓存强制重新获取:
> ```bash
> OLD_TOKEN=$(bash "$HELPER" --old-token --nocache) # 强制重新获取旧版 token
> NEW_TOKEN=$(bash "$HELPER" --token --nocache) # 强制重新获取新版 token
> ```
> **Token Invalid Handling**: dt_helper only caches by time and cannot detect if the token is revoked in advance. If the API returns `errcode 40001`/`40014` (token invalid/expired), use `--nocache` to skip the cache and force a re-acquisition:
> ```bash
> OLD_TOKEN=$(bash "$HELPER" --old-token --nocache) # 强制重新获取旧版 token
> NEW_TOKEN=$(bash "$HELPER" --token --nocache) # 强制重新获取新版 token
> ```references/api.mdgrep -A 30 "^## 1. 按关键词搜索用户" references/api.md
grep -A 50 "^## 2. 获取用户完整详情" references/api.md
grep -A 20 "^## 3. unionId → userId 转换" references/api.md
grep -A 18 "^## 4. 企业员工总人数" references/api.md
grep -A 25 "^## 5. 按关键词搜索部门" references/api.md
grep -A 25 "^## 6. 获取子部门列表" references/api.md
grep -A 20 "^## 7. 获取子部门 ID 列表" references/api.md
grep -A 25 "^## 8. 获取部门详情" references/api.md
grep -A 40 "^## 9. 获取部门成员完整列表" references/api.md
grep -A 18 "^## 10. 获取部门成员 userId 列表" references/api.md
grep -A 20 "^## 11. 获取用户所在部门路径" references/api.md
grep -A 12 "^## 错误码" references/api.md
grep -A 6 "^## 所需应用权限" references/api.mdreferences/api.mdgrep -A 30 "^## 1. 按关键词搜索用户" references/api.md
grep -A 50 "^## 2. 获取用户完整详情" references/api.md
grep -A 20 "^## 3. unionId → userId 转换" references/api.md
grep -A 18 "^## 4. 企业员工总人数" references/api.md
grep -A 25 "^## 5. 按关键词搜索部门" references/api.md
grep -A 25 "^## 6. 获取子部门列表" references/api.md
grep -A 20 "^## 7. 获取子部门 ID 列表" references/api.md
grep -A 25 "^## 8. 获取部门详情" references/api.md
grep -A 40 "^## 9. 获取部门成员完整列表" references/api.md
grep -A 18 "^## 10. 获取部门成员 userId 列表" references/api.md
grep -A 20 "^## 11. 获取用户所在部门路径" references/api.md
grep -A 12 "^## 错误码" references/api.md
grep -A 6 "^## 所需应用权限" references/api.md