Home / Market / DingTalk Contacts

DingTalk Contacts

Accurate query of DingTalk address book. Use when you already have a userId to check details, department, position or email, check the user by complete mobile phone number, or check yourself, department members and roles. For fuzzy search of names, job numbers, responsibilities, superiors and subordinates, use dingtalk-aisearch. After getting the userId, use this skill to fill in the details. Command prefix: dws contact.

skill★ 4240254 dlskills.shApache-2.0Install in CosmosUpstream Source

Documentation & Preview

通讯录(组织架构)

> SKILL.md 中 #8 内联 3 条 lite:get-contact-self、search-person、search-user。下列 recipe、专用规则与消歧请在命中 #8 且超出上述 lite 时阅读本文。 > 产品命令见 contact.md。通用批量/并行见 recipes/conventions.md。

专用规则(#8 非 lite 步骤必守)

  1. 从搜索结果中提取所有同名/多命中用户的 userId
  2. 调用 contact user get --ids userId1,userId2,... 获取每人详情(含 depts 部门列表、职位等)
  3. 将「姓名 + 部门 + 职位」列表展示给用户,请用户确认选择哪一位
  4. 使用用户确认的 userId 继续后续操作

> 根因:aisearch person 不返回完整部门信息,无法仅凭搜索结果区分同名用户。必须追加 contact user get 获取部门信息才能消歧。

与其他场景消歧

Recipe 速查(本表步骤,非 SKILL lite)

| Recipe | 步骤 | |--------|------| | lookup-label-members | 1. contact label list → 浏览全部角色,匹配目标角色的 labelId<br>2. contact label list-members --id <labelId> → 该角色下的成员列表 | | search-user-by-mobile | 1. contact user search-mobile --mobile "<完整手机号>" → 按需 contact user get --ids <userId> | | lookup-dept-id | 1. contact dept search --query "<部门关键词>" → 回显 deptId(多命中须消歧) | | list-subdepts | 1. 已有父 deptId → contact dept list-children --dept <父deptId> 直接取直属子部门列表<br>2. 只有部门名 → 先 lookup-dept-id 取 deptId,再 list-children | | list-dept-members | 1. 优先 python scripts/contact_dept_members.py --query "<部门名>"<br>2. 备选:lookup-dept-id → contact dept list-members --ids <deptId><br>3. 若要每人档案字段:对 userId 批量 contact user get --ids … | | list-multi-dept-members | 1. 对每个部门名 contact dept search --query "<名>" → 各 deptId<br>2. contact dept list-members --ids <id1>,<id2>,...(多部门并行/批量见 conventions)<br>3. 需要档案再 contact user get --ids … | | verify-user-dept | 1. contact dept search --query "<部门名>" → deptId<br>2. contact dept list-members --ids <deptId> 中匹配姓名;或先 search-user lite 再 user get 核对部门字段 |

Full / 多步组合

| Recipe | 行动指南(固定路线) | |--------|---------------------| | explore-subdepts-and-members | 1. 取父部门 deptId:用户给了 ID 直接用;只给名字则 contact dept search --query "<父部门名>" → 父 deptId(多命中先消歧)<br>2. 优先 contact dept list-children --dept <父deptId> 拿到全部直属子 deptId 列表;若用户只点名了部分子部门,则改为对每个子部门名 contact dept search --query "<子部门名>"<br>3. 对子 deptId:contact dept list-members --ids <id1>,<id2>,...(多部门按 conventions 并行/批量)<br>4. 若还要成员详情:汇总 userId → contact user get --ids …(≤30 条/批,超出分批 + 用户确认) | | verify-user-in-dept | 同速查表 verify-user-dept;多轮对话中用户追加「是否在某部门」时叠加本路线 | | cross-level-dept-members | 1. contact dept search --query "<父部门关键词>" → 父 deptId<br>2. 优先 contact dept list-children --dept <父deptId> 枚举全部直属子 deptId;用户已点名的子部门则用 dept search 精确命中<br>3. 需要逐层下钻时,对上一步拿到的子 deptId 继续 dept list-children 递归(注意控制深度,避免一次拉太多)<br>4. contact dept list-members --ids <id1,id2,…> → 按需 user get | | user-detail-organization | 1. aisearch person --query "<关键词>" --dimension <维度> → userId(多结果先消歧)<br>2. 必须 contact user get --ids <userId><br>3. 若用户同时给出部门语境:叠加 verify-user-dept | | batch-users-by-keyword | 1. aisearch person --query "<职位或技能关键词>" --dimension position,duty → 多条<br>2. 提取 userId(≤30)→ contact user get --ids …<br>3. 结果过多时汇总或请用户收窄 |