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
命令完成。
通过
wecom-cli
根据待办 ID 列表批量查询完整详情,包含待办内容和分派人信息。
wecom-cli
is the official command line program provided by WeCom, all operations are completed by executing
wecom-cli
commands.
Batch query complete to-do details by
wecom-cli
based on the to-do ID list, including to-do content and assignee information.

行为策略

Behavior Strategy

人员 ID 转姓名(关键步骤): 返回结果中的
follower_id
creator_id
都是系统内部 ID,直接展示给用户毫无意义——用户不认识这些 ID,只认识姓名。因此在向用户展示待办详情之前,必须先调用
wecomcli-lookup-contact
技能获取通讯录,将所有
follower_id
creator_id
匹配为真实姓名。具体做法:
bash
wecom-cli contact get_userlist '{}'
如果通讯录中找不到某个 ID,展示时标注"未知用户(ID: xxx)"即可。
重试策略: 遭遇"返回 HTTP 错误"或"HTTP 请求失败"时,主动重试,最多重试三次。

Convert personnel ID to name (key step): The
follower_id
and
creator_id
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
wecomcli-lookup-contact
skill to obtain the address book, and match all
follower_id
and
creator_id
to real names. The specific method is as follows:
bash
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

参数类型必填说明
todo_id_list
array待办 ID 列表,最多 20 个
调用示例:
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}'
ParameterTypeRequiredDescription
todo_id_list
arrayTo-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

字段类型说明
data_list
array待办详情列表,最多 20 条
data_list[].todo_id
string待办 ID
data_list[].todo_status
number待办状态:
0
-已完成,
1
-进行中,
2
-已删除
data_list[].content
string待办内容
data_list[].follower_list.followers
array分派人列表
data_list[].follower_list.followers[].follower_id
string分派人 ID(即 userid)— 展示前需通过 wecomcli-lookup-contact 转为姓名
data_list[].follower_list.followers[].follower_status
number分派人状态:
0
-拒绝,
1
-接受,
2
-已完成
data_list[].follower_list.followers[].update_time
string分派人状态更新时间
data_list[].creator_id
string创建人 ID — 展示前需通过 wecomcli-lookup-contact 转为姓名
data_list[].user_status
number当前用户状态
data_list[].remind_time
string提醒时间
data_list[].create_time
string创建时间
data_list[].update_time
string更新时间

FieldTypeDescription
data_list
arrayTo-do detail list, maximum 20 entries
data_list[].todo_id
stringTo-do ID
data_list[].todo_status
numberTo-do status:
0
-Completed,
1
-In progress,
2
-Deleted
data_list[].content
stringTo-do content
data_list[].follower_list.followers
arrayAssignee list
data_list[].follower_list.followers[].follower_id
stringAssignee ID (i.e. userid) — Need to convert to name via wecomcli-lookup-contact before display
data_list[].follower_list.followers[].follower_status
numberAssignee status:
0
-Rejected,
1
-Accepted,
2
-Completed
data_list[].follower_list.followers[].update_time
stringAssignee status update time
data_list[].creator_id
stringCreator ID — Need to convert to name via wecomcli-lookup-contact before display
data_list[].user_status
numberCurrent user status
data_list[].remind_time
stringReminder time
data_list[].create_time
stringCreation time
data_list[].update_time
stringUpdate time

典型工作流

Typical Workflow

列表 + 详情联合查询(三步缺一不可)

List + Detail Joint Query (Three steps are indispensable)

用户问:"看看我最近的待办" / "我有哪些待办事项?"
  1. 第一步:通过 wecomcli-get-todo-list 获取待办列表。
bash
wecom-cli todo get_todo_list '{}'
  1. 第二步:根据返回的 todo_id 批量获取详情。
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2", "TODO_ID_3"]}'
  1. 第三步(不要跳过!):通过 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-01

User asks: "Check my recent to-dos" / "What to-do items do I have?"
  1. Step 1: Obtain the to-do list via wecomcli-get-todo-list.
bash
wecom-cli todo get_todo_list '{}'
  1. 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"]}'
  1. 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

  1. 人员 ID 必须转姓名
    • 返回结果中的
      follower_id
      creator_id
      是系统内部标识,用户无法识别
    • 展示待办详情前,先
    bash
    wecom-cli contact get_userlist '{}'
    获取通讯录
    • 用通讯录的
      userid
      匹配
      follower_id
      /
      creator_id
      ,用
      name
      替换展示
  2. todo_id 来源规则
    • todo_id
      必须来自
      wecomcli-get-todo-list
      返回的结果,禁止自行推测或构造
    • 用户通常提供待办内容描述而非 ID,应先通过
      wecomcli-get-todo-list
      查列表再匹配
  3. 状态值含义
    • 待办状态(
      todo_status
      ):
      0
      -已完成,
      1
      -进行中,
      2
      -已删除
    • 用户状态(
      user_status
      ):
      0
      -拒绝,
      1
      -接受,
      2
      -已完成
    • 分派人状态(
      follower_status
      ):
      0
      -拒绝,
      1
      -接受,
      2
      -已完成
  4. 错误处理:若
    errcode
    不为
    0
    ,告知用户
    errmsg
    中的错误信息
  5. 单次上限
    todo_id_list
    最多传 20 个 ID,超过需要分批请求
  1. Personnel ID must be converted to name
    • The
      follower_id
      and
      creator_id
      in the returned results are internal system identifiers, which cannot be recognized by users
    • Before displaying to-do details, first
    bash
    wecom-cli contact get_userlist '{}'
    to obtain the address book
    • Match
      follower_id
      /
      creator_id
      with the
      userid
      in the address book, and replace the display with
      name
  2. todo_id source rules
    • todo_id
      must come from the results returned by
      wecomcli-get-todo-list
      , and it is forbidden to speculate or construct it by yourself
    • Users usually provide to-do content descriptions instead of IDs, you should first check the list through
      wecomcli-get-todo-list
      and then match
  3. Status value meaning
    • To-do status (
      todo_status
      ):
      0
      -Completed,
      1
      -In progress,
      2
      -Deleted
    • User status (
      user_status
      ):
      0
      -Rejected,
      1
      -Accepted,
      2
      -Completed
    • Assignee status (
      follower_status
      ):
      0
      -Rejected,
      1
      -Accepted,
      2
      -Completed
  4. Error handling: If
    errcode
    is not
    0
    , inform the user of the error information in
    errmsg
  5. Single limit:
    todo_id_list
    can pass up to 20 IDs at a time, and requests need to be made in batches if exceeded