wecomcli-get-todo-list
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese企业微信待办列表查询技能
WeCom To-Do List Query Skill
是企业微信提供的命令行程序,所有操作通过执行wecom-cli命令完成。wecom-cli
通过 查询企业微信待办列表,支持按时间过滤和分页。
wecom-cliis a command line program provided by WeCom, and all operations are completed by executingwecom-clicommands.wecom-cli
Query WeCom to-do list via , supporting time filtering and pagination.
wecom-cli行为策略
Behavior Strategy
查完列表必须查详情: 本接口只返回待办 ID 和状态等概要信息,不包含待办的实际内容和分派人。对用户来说,没有内容的待办列表毫无用处——他们想知道的是"要做什么",而不是一串 ID。因此,每次调用 get_todo_list 拿到结果后,都要紧接着用返回的 todo_id 列表调用 获取完整详情(内容、分派人等),然后再向用户展示。这不是可选步骤,而是完成用户请求的必要环节。
wecomcli-get-todo-detail分页未拉完时必须提醒用户: 接口是分页的,不要求一次性拉完所有数据。但如果响应中 为 ,说明后面还有待办没有返回——这时你在展示当前结果的同时,必须明确告诉用户"还有更多待办未显示,是否需要继续查看?"。用户可能不知道后面还有数据,如果你不说,他们会以为看到的就是全部,这会导致遗漏重要待办。这是一个容易被忽略但后果严重的点,请务必执行。
has_moretrue重试策略: 遭遇"返回 HTTP 错误"或"HTTP 请求失败"时,主动重试,最多重试三次。
Must query details after getting the list: This interface only returns summary information such as to-do ID and status, and does not include the actual content of the to-do and the assignee. For users, a to-do list without content is completely useless - what they want to know is "what to do", not a string of IDs. Therefore, after each call to get_todo_list to get the result, you must immediately use the returned todo_id list to call to get complete details (content, assignee, etc.) before displaying them to the user. This is not an optional step, but a necessary link to complete the user's request.
wecomcli-get-todo-detailMust remind users when pagination is not fully pulled: The interface is paginated, and it is not required to pull all data at one time. But if in the response is , it means that there are still to-dos not returned later - when you display the current results, you must clearly tell the user "There are more to-dos not displayed, do you need to continue viewing?". Users may not know that there is more data later, if you don't mention it, they will think what they see is all, which will lead to missing important to-dos. This is a point that is easy to ignore but has serious consequences, please be sure to implement it.
has_moretrueRetry strategy: When encountering "return HTTP error" or "HTTP request failure", take the initiative to retry, up to three times.
调用方式
Calling Method
bash
wecom-cli todo get_todo_list '<json格式的入参>'bash
wecom-cli todo get_todo_list '<json格式的入参>'参数说明
Parameter Description
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ❌ | 创建开始时间,格式: |
| string | ❌ | 创建结束时间,格式: |
| string | ❌ | 提醒开始时间,格式: |
| string | ❌ | 提醒结束时间,格式: |
| number | ❌ | 最大返回数量,默认 10,最大 20 |
| string | ❌ | 分页游标,首次请求不传,后续传入上次响应的 |
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | ❌ | Creation start time, format: |
| string | ❌ | Creation end time, format: |
| string | ❌ | Reminder start time, format: |
| string | ❌ | Reminder end time, format: |
| number | ❌ | Maximum number of returned items, default 10, maximum 20 |
| string | ❌ | Pagination cursor, not passed for the first request, pass the |
返回格式
Return Format
json
{
"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
}json
{
"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
| 字段 | 类型 | 说明 |
|---|---|---|
| array | 待办列表 |
| string | 待办唯一 ID |
| number | 待办状态: |
| number | 用户状态: |
| string | 创建人 ID |
| string | 提醒时间 |
| string | 创建时间 |
| string | 更新时间 |
| string | 下一页游标 |
| boolean | 是否还有更多记录 |
列表返回的是待办概要信息(不含内容和分派人)。拿到列表后,必须调用获取完整详情再展示给用户。wecomcli-get-todo-detail
| Field | Type | Description |
|---|---|---|
| array | To-do list |
| string | Unique to-do ID |
| number | To-do status: |
| number | User status: |
| string | Creator ID |
| string | Reminder time |
| string | Creation time |
| string | Update time |
| string | Next page cursor |
| boolean | Whether there are more records |
The list returns to-do summary information (excluding content and assignees). After getting the list, you must callto get complete details before displaying them to the user.wecomcli-get-todo-detail
典型工作流
Typical Workflow
查看待办列表(标准两步流程)
View To-do List (Standard Two-step Process)
用户问:"看看我最近的待办" / "我有哪些待办事项?" / "我还有多少事要做?"
- 第一步:获取待办列表(只有 ID 和状态,没有内容)。
bash
wecom-cli todo get_todo_list '{}'- 第二步(禁止跳过!):用返回的 todo_id 列表调用 wecomcli-get-todo-detail 获取完整详情。
bash
wecom-cli todo get_todo_detail '{"todo_id_list": ["返回的TODO_ID_1", "返回的TODO_ID_2"]}'两步缺一不可——只有拿到详情后,才能向用户展示有意义的待办内容。
- 第三步(条件执行):检查第一步返回的 字段。如果为
has_more,在展示结果时必须提醒用户:"以上是部分待办,还有更多待办未显示,需要我继续查看吗?"——不提醒的话,用户会以为这就是全部。true
User asks: "Check 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 ID and status, no content).
bash
wecom-cli todo get_todo_list '{}'- Step 2 (Prohibited to skip!): Call wecomcli-get-todo-detail with the returned todo_id list to get complete details.
bash
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 display meaningful to-do content to the user.
- Step 3 (Conditional execution): Check the field returned in the first step. If it is
has_more, you must remind the user when displaying the results: "The above are part of the to-dos, there are more to-dos not displayed, do you need me to continue checking?" - If you don't remind, users will think this is all.true
按时间范围查询
Query by Time Range
用户问:"这个月创建的待办有哪些?"
bash
wecom-cli todo get_todo_list '{"create_begin_time": "2025-03-01 00:00:00", "create_end_time": "2025-03-31 23:59:59"}'User asks: "What are the to-dos created this month?"
bash
wecom-cli todo get_todo_list '{"create_begin_time": "2025-03-01 00:00:00", "create_end_time": "2025-03-31 23:59:59"}'分页获取大量待办
Pagination to Get a Large Number of To-dos
当待办数量超过单页上限时,通过 循环分页拉取:
cursor- 首次请求(不传 cursor):
bash
wecom-cli todo get_todo_list '{"limit": 20}',如果没有拉取完,还有更多的待办,会返回 has_more=true, next_cursor="CURSOR_1"
- 第二次请求(传入上次的 next_cursor):
bash
wecom-cli todo get_todo_list '{"limit": 20, "cursor": "CURSOR_1"}',返回 has_more=false,拉取完毕
分页规则:
- 首次请求不传
cursor - 为
has_more时,将true作为下次请求的next_cursor传入cursor - 为
has_more时停止请求false - 分页过程中时间过滤参数保持不变
- 如果选择不继续翻页(比如当前页数据已经够用),必须告诉用户还有更多待办未显示,问用户是否需要继续查看
When the number of to-dos exceeds the single-page limit, pull pages cyclically through :
cursor- First request (no cursor passed):
bash
wecom-cli todo get_todo_list '{"limit": 20}'If the pulling is not completed and there are more to-dos, it will return has_more=true, next_cursor="CURSOR_1"
- Second request (pass the next_cursor from the last time):
bash
wecom-cli todo get_todo_list '{"limit": 20, "cursor": "CURSOR_1"}'Return has_more=false, pulling completed
Pagination rules:
- Do not pass for the first request
cursor - When is
has_more, passtrueas thenext_cursorof the next requestcursor - Stop the request when is
has_morefalse - The time filter parameters remain unchanged during pagination
- If you choose not to continue turning pages (for example, the current page data is enough), you must tell the user that there are more to-dos not displayed, and ask the user if they need to continue viewing
注意事项
Notes
-
时间格式:所有时间参数使用格式,用户说"明天"、"下周一"等相对时间时,根据当前日期推算具体日期
YYYY-MM-DD HH:mm:ss -
状态值含义
- 待办状态():
todo_status-已完成,0-进行中,1-已删除2 - 用户状态():
user_status-拒绝,0-接受,1-已完成2
- 待办状态(
-
错误处理:若不为
errcode,告知用户0中的错误信息errmsg -
必须查详情:本接口返回的是概要信息(不含内容和分派人),拿到列表后必须紧接着调用获取完整内容再展示给用户,不要只展示列表概要
wecomcli-get-todo-detail -
分页未拉完必须提醒:如果返回的为
has_more,在向用户展示结果时必须明确说明"还有更多待办未显示"并询问用户是否需要继续查看。用户不知道后面还有数据,不提醒会导致遗漏true
-
Time format: All time parameters use theformat. When users say relative times such as "tomorrow", "next Monday", calculate the specific date according to the current date
YYYY-MM-DD HH:mm:ss -
Status value meaning
- To-do status ():
todo_status-Completed,0-In progress,1-Deleted2 - User status ():
user_status-Rejected,0-Accepted,1-Completed2
- To-do status (
-
Error handling: Ifis not
errcode, inform the user of the error information in0errmsg -
Must query details: This interface returns summary information (excluding content and assignees). After getting the list, you must immediately callto get the complete content before displaying it to the user, do not only display the list summary
wecomcli-get-todo-detail -
Must remind when pagination is not fully pulled: If the returnedis
has_more, when displaying the results to the user, you must clearly state "There are more to-dos not displayed" and ask the user if they need to continue viewing. Users do not know that there is more data later, and not reminding will lead to omissionstrue