wecomcli-get-todo-detail
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese企业微信待办详情查询技能
WeCom To-Do Detail Query Skill
是企业微信提供的命令行程序,所有操作通过执行wecom-cli命令完成。wecom-cli
通过 根据待办 ID 列表批量查询完整详情,包含待办内容和分派人信息。
wecom-cliis the official command line program provided by WeCom, all operations are completed by executingwecom-clicommands.wecom-cli
Batch query complete to-do details by based on the to-do ID list, including to-do content and assignee information.
wecom-cli行为策略
Behavior Strategy
人员 ID 转姓名(关键步骤): 返回结果中的 和 都是系统内部 ID,直接展示给用户毫无意义——用户不认识这些 ID,只认识姓名。因此在向用户展示待办详情之前,必须先调用 技能获取通讯录,将所有 和 匹配为真实姓名。具体做法:
follower_idcreator_idwecomcli-lookup-contactfollower_idcreator_idbash
wecom-cli contact get_userlist '{}'如果通讯录中找不到某个 ID,展示时标注"未知用户(ID: xxx)"即可。
重试策略: 遭遇"返回 HTTP 错误"或"HTTP 请求失败"时,主动重试,最多重试三次。
Convert personnel ID to name (key step): The and in the returned results are internal system IDs, which are meaningless to display directly to users -- users do not recognize these IDs, only names. Therefore, before displaying the to-do details to users, you must first call the skill to obtain the address book, and match all and to real names. The specific method is as follows:
follower_idcreator_idwecomcli-lookup-contactfollower_idcreator_idbash
wecom-cli contact get_userlist '{}'If an ID cannot be found in the address book, mark it as "Unknown user (ID: xxx)" when displaying.
Retry strategy: When encountering "return HTTP error" or "HTTP request failure", actively retry, up to three times.
调用方式
Calling Method
bash
wecom-cli todo get_todo_detail '<json格式的入参>'bash
wecom-cli todo get_todo_detail '<JSON format input parameter>'参数说明
Parameter Description
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| array | ✅ | 待办 ID 列表,最多 20 个 |
调用示例:
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}'| Parameter | Type | Required | Description |
|---|---|---|---|
| array | ✅ | To-do ID list, maximum 20 entries |
Call example:
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}'返回格式
Return Format
json
{
"errcode": 0,
"errmsg": "ok",
"data_list": [
{
"todo_id": "TODO_ID",
"todo_status": 1,
"content": "完成Q2规划文档",
"follower_list": {
"followers": [
{
"follower_id": "FOLLOWER_ID",
"follower_status": 1,
"update_time": "2025-01-16 14:20:00"
}
]
},
"creator_id": "CREATOR_ID",
"user_status": 1,
"remind_time": "2025-06-01 09:00:00",
"create_time": "2025-01-15 10:30:00",
"update_time": "2025-01-16 14:20:00"
}
]
}json
{
"errcode": 0,
"errmsg": "ok",
"data_list": [
{
"todo_id": "TODO_ID",
"todo_status": 1,
"content": "Complete Q2 planning document",
"follower_list": {
"followers": [
{
"follower_id": "FOLLOWER_ID",
"follower_status": 1,
"update_time": "2025-01-16 14:20:00"
}
]
},
"creator_id": "CREATOR_ID",
"user_status": 1,
"remind_time": "2025-06-01 09:00:00",
"create_time": "2025-01-15 10:30:00",
"update_time": "2025-01-16 14:20:00"
}
]
}返回字段说明
Return Field Description
| 字段 | 类型 | 说明 |
|---|---|---|
| array | 待办详情列表,最多 20 条 |
| string | 待办 ID |
| number | 待办状态: |
| string | 待办内容 |
| array | 分派人列表 |
| string | 分派人 ID(即 userid)— 展示前需通过 wecomcli-lookup-contact 转为姓名 |
| number | 分派人状态: |
| string | 分派人状态更新时间 |
| string | 创建人 ID — 展示前需通过 wecomcli-lookup-contact 转为姓名 |
| number | 当前用户状态 |
| string | 提醒时间 |
| string | 创建时间 |
| string | 更新时间 |
| Field | Type | Description |
|---|---|---|
| array | To-do detail list, maximum 20 entries |
| string | To-do ID |
| number | To-do status: |
| string | To-do content |
| array | Assignee list |
| string | Assignee ID (i.e. userid) — Need to convert to name via wecomcli-lookup-contact before display |
| number | Assignee status: |
| string | Assignee status update time |
| string | Creator ID — Need to convert to name via wecomcli-lookup-contact before display |
| number | Current user status |
| string | Reminder time |
| string | Creation time |
| string | Update time |
典型工作流
Typical Workflow
列表 + 详情联合查询(三步缺一不可)
List + Detail Joint Query (Three steps are indispensable)
用户问:"看看我最近的待办" / "我有哪些待办事项?"
- 第一步:通过 wecomcli-get-todo-list 获取待办列表。
bash
wecom-cli todo get_todo_list '{}'- 第二步:根据返回的 todo_id 批量获取详情。
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2", "TODO_ID_3"]}'- 第三步(不要跳过!):通过 wecomcli-lookup-contact 获取通讯录,将 follower_id / creator_id 转为姓名。用返回的 userlist 中的 userid 匹配 follower_id 和 creator_id,取 name 字段作为展示姓名
第三步是展示可读结果的前提。没有这一步,用户看到的是一串无意义的 ID 而非姓名。
展示格式(注意:分派人和创建人必须显示为姓名,不是 ID):
📋 您当前的待办事项(共 3 项)
1. 🔵 完成Q2规划文档
- 待办状态:进行中 | 我的状态:已接受
- 提醒时间:2025-06-01 09:00
- 分派人:张三、李四
- 创建时间:2025-01-15
2. 🔵 提交周报
- 待办状态:进行中 | 我的状态:已接受
- 提醒时间:2025-03-17 18:00
- 创建时间:2025-03-10
3. ☑️ 代码评审
- 待办状态:已完成 | 我的状态:已完成
- 创建时间:2025-03-01User asks: "Check my recent to-dos" / "What to-do items do I have?"
- Step 1: Obtain the to-do list via wecomcli-get-todo-list.
bash
wecom-cli todo get_todo_list '{}'- Step 2: Batch obtain details based on the returned todo_id.
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2", "TODO_ID_3"]}'- Step 3 (Do not skip!): Obtain the address book via wecomcli-lookup-contact, convert follower_id / creator_id to names. Match follower_id and creator_id with the userid in the returned userlist, and take the name field as the display name.
Step 3 is the prerequisite for displaying readable results. Without this step, users will see a string of meaningless IDs instead of names.
Display format (Note: Assignees and creators must be displayed as names, not IDs):
📋 Your current to-do items (3 items in total)
1. 🔵 Complete Q2 planning document
- To-do status: In progress | My status: Accepted
- Reminder time: 2025-06-01 09:00
- Assignees: Zhang San, Li Si
- Creation time: 2025-01-15
2. 🔵 Submit weekly report
- To-do status: In progress | My status: Accepted
- Reminder time: 2025-03-17 18:00
- Creation time: 2025-03-10
3. ☑️ Code review
- To-do status: Completed | My status: Completed
- Creation time: 2025-03-01注意事项
Notes
-
人员 ID 必须转姓名
- 返回结果中的 和
follower_id是系统内部标识,用户无法识别creator_id - 展示待办详情前,先
bashwecom-cli contact get_userlist '{}'获取通讯录- 用通讯录的 匹配
userid/follower_id,用creator_id替换展示name
- 返回结果中的
-
todo_id 来源规则
- 必须来自
todo_id返回的结果,禁止自行推测或构造wecomcli-get-todo-list - 用户通常提供待办内容描述而非 ID,应先通过 查列表再匹配
wecomcli-get-todo-list
-
状态值含义
- 待办状态():
todo_status-已完成,0-进行中,1-已删除2 - 用户状态():
user_status-拒绝,0-接受,1-已完成2 - 分派人状态():
follower_status-拒绝,0-接受,1-已完成2
- 待办状态(
-
错误处理:若不为
errcode,告知用户0中的错误信息errmsg -
单次上限:最多传 20 个 ID,超过需要分批请求
todo_id_list
-
Personnel ID must be converted to name
- The and
follower_idin the returned results are internal system identifiers, which cannot be recognized by userscreator_id - Before displaying to-do details, first
bashwecom-cli contact get_userlist '{}'to obtain the address book- Match /
follower_idwith thecreator_idin the address book, and replace the display withuseridname
- The
-
todo_id source rules
- must come from the results returned by
todo_id, and it is forbidden to speculate or construct it by yourselfwecomcli-get-todo-list - Users usually provide to-do content descriptions instead of IDs, you should first check the list through and then match
wecomcli-get-todo-list
-
Status value meaning
- To-do status ():
todo_status-Completed,0-In progress,1-Deleted2 - User status ():
user_status-Rejected,0-Accepted,1-Completed2 - Assignee status ():
follower_status-Rejected,0-Accepted,1-Completed2
- To-do status (
-
Error handling: Ifis not
errcode, inform the user of the error information in0errmsg -
Single limit:can pass up to 20 IDs at a time, and requests need to be made in batches if exceeded
todo_id_list