wecom-cliis a command-line program provided by WeCom. All operations are completed by executing thewecom-clicommand.
Use wecom-cli to query the WeCom todo list, supporting time filtering and pagination.
Behavior strategy
After querying the list, you must query details: This interface only returns summary information such as todo ID and status, and does not include the todo's actual content and assignee. To users, a todo list without content is useless—what they want to know is "what to do", not a string of IDs. Therefore, every time after calling get_todo_list and getting results, you must immediately use the returned todo_id list to call wecomcli-get-todo-detail to get complete details (content, assignee, etc.), and then show them to the user. This is not an optional step, but a necessary part of fulfilling the user's request.
When pagination is not fully retrieved, you must remind the user: The interface is paginated, and it is not required to retrieve all data at once. But if in the response has_more is true, it means there are still todos not returned afterward—at this time, while displaying the current results, you must clearly tell the user "there are more todos not shown. Do you need to continue viewing?" The user may not know there is more data afterward. If you do not say so, they will think what they see is all, which can lead to missing important todos. This is a point that is easy to overlook but has serious consequences, so please be sure to do it.
Retry strategy: When encountering "returned HTTP error" or "HTTP request failed", actively retry, up to three times.
Invocation method
wecom-cli todo get_todo_list '<json格式的入参>'
Parameter description
| Parameter | Type | Required | Description |
|---|---|---|---|
create_begin_time |
string | ❌ | Creation start time, format:YYYY-MM-DD HH:mm:ss |
create_end_time |
string | ❌ | Creation end time, format:YYYY-MM-DD HH:mm:ss |
remind_begin_time |
string | ❌ | Reminder start time, format:YYYY-MM-DD HH:mm:ss |
remind_end_time |
string | ❌ | Reminder end time, format:YYYY-MM-DD HH:mm:ss |
limit |
number | ❌ | Maximum number of results to return, default 10, maximum 20 |
cursor |
string | ❌ | Pagination cursor. Do not pass it on the first request; on subsequent requests, pass the previous response's next_cursor |
Return format
{
"errcode": 0,
"errmsg": "ok",
"index_list": [
{
"todo_id": "TODO_ID",
"todo_status": 1,
"user_status": 1,
"creator_id": "CREATOR_ID",
"remind_time": "2025-06-01 09:00:00",
"create_time": "2025-01-15 10:30:00",
"update_time": "2025-01-16 14:20:00"
}
],
"next_cursor": "NEXT_CURSOR",
"has_more": false
}
Return field description
| Field | Type | Description |
|---|---|---|
index_list |
array | Todo list |
index_list[].todo_id |
string | Todo unique ID |
index_list[].todo_status |
number | Todo status:0-Completed,1-In progress,2-Deleted |
index_list[].user_status |
number | User status:0-Rejected,1-Accepted,2-Completed |
index_list[].creator_id |
string | Creator ID |
index_list[].remind_time |
string | Reminder time |
index_list[].create_time |
string | Creation time |
index_list[].update_time |
string | Update time |
next_cursor |
string | Next page cursor |
has_more |
boolean | Whether there are more records |
The list returns todo summary information (excluding content and assignee). After getting the list, you must call
wecomcli-get-todo-detailto get complete details before showing them to the user.
Typical Workflow
View the to-do list (standard two-step process)
User asks: "Show me my recent to-dos" / "What to-do items do I have?" / "How many things do I still have to do?"
- Step 1: Get the to-do list (only IDs and statuses, no content).
wecom-cli todo get_todo_list '{}'
- Step 2 (do not skip!): Use the returned todo_id list to call wecomcli-get-todo-detail to get the full details.
wecom-cli todo get_todo_detail '{"todo_id_list": ["返回的TODO_ID_1", "返回的TODO_ID_2"]}'
Both steps are indispensable—only after getting the details can you show the user meaningful to-do content.
- Step 3 (conditional execution): Check the
has_morefield returned in Step 1. If it istrue, when displaying the results you must remind the user: "The above are some of the to-dos; there are more to-dos not displayed. Would you like me to continue checking?"—without this reminder, the user will think this is all of them.
Query by time range
User asks: "What to-dos were created this month?"
wecom-cli todo get_todo_list '{"create_begin_time": "2025-03-01 00:00:00", "create_end_time": "2025-03-31 23:59:59"}'
Get a large number of to-dos with pagination
When the number of to-dos exceeds the single-page limit, fetch pages in a cursor loop:
- First request (do not pass cursor):
wecom-cli todo get_todo_list '{"limit": 20}'
, if not all have been fetched and there are more to-dos, it will return has_more=true, next_cursor="CURSOR_1"
- Second request (pass the previous next_cursor):
wecom-cli todo get_todo_list '{"limit": 20, "cursor": "CURSOR_1"}'
, returns has_more=false, fetching is complete
Pagination rules:
- The first request does not pass
cursor has_moreistrue, passnext_cursoras thecursorfor the next requesthas_moreisfalse, stop making requests- During pagination, the time filter parameters remain unchanged
- If you choose not to continue paging (for example, the current page's data is already sufficient), you must tell the user that there are more to-dos not displayed and ask whether the user needs to continue checking
Notes
-
Time format: All time parameters use the
YYYY-MM-DD HH:mm:ssformat. When the user says relative times such as "tomorrow" or "next Monday", calculate the specific date based on the current date -
Meaning of status values
- To-do status (
todo_status):0-completed,1-in progress,2-deleted - User status (
user_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 -
Details must be fetched: This API returns summary information (excluding content and assignee). After getting the list, you must immediately call
wecomcli-get-todo-detailto get the full content before displaying it to the user. Do not display only the list summary -
If pagination is not complete, you must remind: If the returned
has_moreistrue, when displaying the results to the user you must clearly state "there are more to-dos not displayed" and ask the user whether they need to continue checking. The user does not know there is more data afterward; failing to remind them will cause omissions