wecom-cliis a command-line program provided by WeCom. All operations are performed by executingwecom-clicommands.
Through wecom-cli , batch query complete details based on a list of todo IDs, including todo content and assignee information.
Behavior Strategy
Convert person IDs to names (key step): In the returned results, follower_id and creator_id are both internal system IDs. Displaying them directly to the user is meaningless — the user does not recognize these IDs, only names. Therefore, before displaying the todo details to the user, you must first call the wecomcli-lookup-contact skill to obtain the contacts, and match all follower_id and creator_id to real names. Specifically:
wecom-cli contact get_userlist '{}'
If a certain ID cannot be found in the contacts, simply label it as "Unknown User (ID: xxx)" when displaying.
Retry Strategy: When encountering "returned HTTP error" or "HTTP request failed", actively retry, up to three times.
How to Call
wecom-cli todo get_todo_detail '<json格式的入参>'
Parameter Description
| Parameter | Type | Required | Description |
|---|---|---|---|
todo_id_list |
array | ✅ | List of todo IDs, up to 20 |
Call example:
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}'
Return Format
{
"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"
}
]
}
Return Field Description
| Field | Type | Description |
|---|---|---|
data_list |
array | List of todo details, up to 20 |
data_list[].todo_id |
string | Todo ID |
data_list[].todo_status |
number | Todo status:0-Completed,1-In progress,2-Deleted |
data_list[].content |
string | Todo content |
data_list[].follower_list.followers |
array | Assignee list |
data_list[].follower_list.followers[].follower_id |
string | Assignee ID (i.e. userid) — must be converted to a name via wecomcli-lookup-contact before display |
data_list[].follower_list.followers[].follower_status |
number | Assignee status:0-Rejected,1-Accepted,2-Completed |
data_list[].follower_list.followers[].update_time |
string | Assignee status update time |
data_list[].creator_id |
string | Creator ID — must be converted to a name via wecomcli-lookup-contact before display |
data_list[].user_status |
number | Current user status |
data_list[].remind_time |
string | Reminder time |
data_list[].create_time |
string | Creation time |
data_list[].update_time |
string | Update time |
Typical Workflow
Combined list + detail query (all three steps are indispensable)
User asks: "Show me my recent todos" / "What todo items do I have?"
- Step 1: Get the todo list via wecomcli-get-todo-list.
wecom-cli todo get_todo_list '{}'
- Step 2: Batch get details based on the returned todo_id.
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 contacts via wecomcli-lookup-contact, and convert follower_id / creator_id to names. Use the userid in the returned userlist to match follower_id and creator_id, and take the name field as the display name
Step 3 is the prerequisite for displaying readable results. Without this step, the user sees a string of meaningless IDs instead of names.
Display format (note: the assigner and creator must be displayed as names, not IDs):
📋 您当前的待办事项(共 3 项)
1. 🔵 完成Q2规划文档
- 待办状态:进行中 | 我的状态:已接受
- 提醒时间:2025-06-01 09:00
- 分派人:张三、李四
- 创建时间:2025-01-15
2. 🔵 提交周报
- 待办状态:进行中 | 我的状态:已接受
- 提醒时间:2025-03-17 18:00
- 创建时间:2025-03-10
3. ☑️ 代码评审
- 待办状态:已完成 | 我的状态:已完成
- 创建时间:2025-03-01
Notes
-
Personnel IDs must be converted to names
- In the returned result,
follower_idandcreator_idare internal system identifiers that users cannot recognize - Before displaying the to-do details, first
wecom-cli contact get_userlist '{}'Get the contacts
- Use the contacts'
useridto matchfollower_id/creator_id, and usenameto replace for display
- In the returned result,
-
todo_id source rule
todo_idmust come fromwecomcli-get-todo-listthe returned result; it is forbidden to infer or construct it yourself- Users usually provide a to-do content description rather than an ID, so you should first use
wecomcli-get-todo-listto query the list and then match
-
Status value meanings
- To-do status (
todo_status):0-Completed,1-In progress,2-Deleted - User status (
user_status):0-Rejected,1-Accepted,2-Completed - Assigner status (
follower_status):0-Rejected,1-Accepted,2-Completed
- To-do status (
-
Error handling: if
errcodeis not0, inform the user of the error message inerrmsgerror message in -
Single request upper limit:
todo_id_listcan pass at most 20 IDs; if exceeded, batch the requests