wecomcli-edit-todo
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese企业微信待办事项编辑技能
WeCom To-Do Item Editing Skill
是企业微信提供的命令行程序,所有操作通过执行wecom-cli命令完成。wecom-cli
通过 对企业微信待办事项进行写操作,支持四种操作:创建待办、更新待办、删除待办、变更用户状态。
wecom-cliis the official command line program provided by WeCom, all operations are completed by executingwecom-clicommands.wecom-cli
Perform write operations on WeCom to-do items via , supporting four types of operations: create to-do, update to-do, delete to-do, change user status.
wecom-cli行为策略
Behavior Strategy
重试策略: 遭遇"返回 HTTP 错误"或"HTTP 请求失败"时,主动重试,最多重试三次。
Retry Policy: When encountering "HTTP error returned" or "HTTP request failed", retry actively, with a maximum of 3 retries.
操作
Operations
1. 创建待办
1. Create To-Do
创建一个新的待办事项,可指定内容、分派人和提醒时间:
bash
wecom-cli todo create_todo '<json格式的入参>'参数说明:
需要遵循 “注意事项”中的格式要求:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ✅ | 待办内容 |
| object | ❌ | 分派人列表,格式见注意事项第 7 条 |
| string | ❌ | 提醒时间,格式: |
调用示例:
bash
wecom-cli todo create_todo '{"content": "<待办的内容>", "remind_time": "2025-06-01 09:00:00"}'返回格式:
json
{
"errcode": 0,
"errmsg": "ok",
"todo_id": "TODO_ID"
}Create a new to-do item, you can specify the content, assignees and reminder time:
bash
wecom-cli todo create_todo '<json format input parameters>'Parameter Description:
Need to comply with the format requirements in "Notes":
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | ✅ | To-do content |
| object | ❌ | Assignee list, see Note 7 for format |
| string | ❌ | Reminder time, format: |
Call Example:
bash
wecom-cli todo create_todo '{"content": "<to-do content>", "remind_time": "2025-06-01 09:00:00"}'Return Format:
json
{
"errcode": 0,
"errmsg": "ok",
"todo_id": "TODO_ID"
}2. 更新待办
2. Update To-Do
修改已有待办事项的内容、分派人、状态或提醒时间:
bash
wecom-cli todo update_todo '<json格式的入参>'参数说明:
需要遵循 “注意事项”中的格式要求:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ✅ | 待办 ID |
| string | ❌ | 新的待办内容 |
| object | ❌ | 新的分派人列表(全量替换,非追加),格式见注意事项第 7 条。若要新增分派人,需先查出现有分派人,合并后一起提交 |
| number | ❌ | 新的待办状态: |
| string | ❌ | 新的提醒时间 |
调用示例:
bash
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "content": "<待办的内容>", "remind_time": "2025-07-01 09:00:00"}'返回格式:
json
{
"errcode": 0,
"errmsg": "ok"
}Modify the content, assignees, status or reminder time of an existing to-do item:
bash
wecom-cli todo update_todo '<json format input parameters>'Parameter Description:
Need to comply with the format requirements in "Notes":
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | ✅ | To-do ID |
| string | ❌ | New to-do content |
| object | ❌ | New assignee list (full replacement, not append), see Note 7 for format. If you need to add new assignees, you need to query the existing assignees first, merge them and submit together |
| number | ❌ | New to-do status: |
| string | ❌ | New reminder time |
Call Example:
bash
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "content": "<to-do content>", "remind_time": "2025-07-01 09:00:00"}'Return Format:
json
{
"errcode": 0,
"errmsg": "ok"
}3. 删除待办
3. Delete To-Do
删除指定的待办事项:
bash
wecom-cli todo delete_todo '<json格式的入参>'参数说明:
需要遵循 “注意事项”中的格式要求:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ✅ | 待办 ID |
调用示例:
bash
wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'返回格式:
json
{
"errcode": 0,
"errmsg": "ok"
}删除操作不可撤销,执行前应向用户确认。 注意:与delete_todo设置update_todo效果相同,优先使用todo_status=2。delete_todo
Delete the specified to-do item:
bash
wecom-cli todo delete_todo '<json format input parameters>'Parameter Description:
Need to comply with the format requirements in "Notes":
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | ✅ | To-do ID |
Call Example:
bash
wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'Return Format:
json
{
"errcode": 0,
"errmsg": "ok"
}Deletion operation is irreversible, you should confirm with the user before execution. Note:has the same effect as settingdelete_todointodo_status=2,update_todois preferred.delete_todo
4. 变更用户待办状态
4. Change User To-Do Status
更改当前用户在某个待办中的状态(拒绝/接受/已完成):
bash
wecom-cli todo change_todo_user_status '<json格式的入参>'参数说明:
需要遵循 “注意事项”中的格式要求:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ✅ | 待办 ID |
| number | ✅ | 用户状态: |
调用示例:
bash
wecom-cli todo change_todo_user_status '{"todo_id": "TODO_ID", "user_status": 2}'返回格式:
json
{
"errcode": 0,
"errmsg": "ok"
}Change the current user's status in a to-do (Reject/Accept/Completed):
bash
wecom-cli todo change_todo_user_status '<json format input parameters>'Parameter Description:
Need to comply with the format requirements in "Notes":
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | ✅ | To-do ID |
| number | ✅ | User status: |
Call Example:
bash
wecom-cli todo change_todo_user_status '{"todo_id": "TODO_ID", "user_status": 2}'Return Format:
json
{
"errcode": 0,
"errmsg": "ok"
}典型工作流
Typical Workflows
创建待办并分派给同事
Create To-Do and Assign to Colleague
用户问:"帮我创建一个待办,让张三下周一前完成需求文档"
- 第一步:通过 wecomcli-lookup-contact 技能查询张三的 userid,在返回结果中筛选姓名为"张三"的成员,获取其 userid
- 第二步:创建待办并分派:
wecom-cli todo create_todo '{"content": "<待办的内容>", "follower_list": {"followers": [{"follower_id": "zhangsan", "follower_status": 1}]}, "remind_time": "2025-03-24 09:00:00"}'
必须来自follower_id技能的wecomcli-lookup-contact接口返回的get_userlist,禁止自行猜测。若搜索结果有多个同名人员,需展示候选列表让用户确认。userid
User asks: "Help me create a to-do, ask Zhang San to finish the requirement document before next Monday"
- Step 1: Query Zhang San's userid through the wecomcli-lookup-contact skill, filter members with the name "Zhang San" from the returned results to get his userid
- Step 2: Create and assign the to-do:
wecom-cli todo create_todo '{"content": "<to-do content>", "follower_list": {"followers": [{"follower_id": "zhangsan", "follower_status": 1}]}, "remind_time": "2025-03-24 09:00:00"}'
must come from thefollower_idreturned by theuseridinterface of theget_userlistskill, guessing is prohibited. If there are multiple people with the same name in the search results, you need to display a candidate list for the user to confirm.wecomcli-lookup-contact
标记待办完成
Mark To-Do as Completed
需要区分两种场景:标记待办本身完成(改 )和标记我的参与状态为完成(改 )。
todo_statususer_statusTwo scenarios need to be distinguished: Mark the to-do itself as completed (modify ) and Mark my participation status as completed (modify ).
todo_statususer_status场景 A:标记待办本身完成
Scenario A: Mark the to-do itself as completed
用户问:"把'完成Q2规划文档'这个待办标记为完成" / "关闭这个待办"
- 第一步:通过 wecomcli-get-todo-list 获取待办列表,找到目标待办的 todo_id:
wecom-cli todo get_todo_list '{}' - 第二步:通过 wecomcli-get-todo-detail 获取详情,确认是目标待办:
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - 第三步:确认后,将待办状态改为已完成:
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "todo_status": 0}'
User asks: "Mark the to-do 'Complete Q2 planning document' as completed" / "Close this to-do"
- Step 1: Get the to-do list through wecomcli-get-todo-list, find the todo_id of the target to-do:
wecom-cli todo get_todo_list '{}' - Step 2: Get details through wecomcli-get-todo-detail to confirm it is the target to-do:
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - Step 3: After confirmation, change the to-do status to completed:
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "todo_status": 0}'
场景 B:标记我的参与状态为完成
Scenario B: Mark my participation status as completed
用户问:"我已经完成了这个待办" / "标记我的部分为完成"
- 第一步:通过 wecomcli-get-todo-list 获取待办列表,找到目标待办的 todo_id:
wecom-cli todo get_todo_list '{}' - 第二步:通过 wecomcli-get-todo-detail 获取详情,确认是目标待办:
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - 第三步:确认后,变更当前用户的参与状态为已完成:
wecom-cli todo change_todo_user_status '{"todo_id": "TODO_ID", "user_status": 2}'
如何判断用户意图: 如果用户说"标记完成"且该待办是自己创建的、没有其他分派人,通常指场景 A(标记待办本身完成)。如果该待办有多个参与人,用户可能只是想标记自己那部分完成(场景 B)。不确定时应向用户确认。
用户提供的是待办内容描述而非 ID,所以需要先通过 wecomcli-get-todo-list 和 wecomcli-get-todo-detail 查找再匹配。匹配到多个相似待办时,列出候选项让用户确认。
User asks: "I have finished this to-do" / "Mark my part as completed"
- Step 1: Get the to-do list through wecomcli-get-todo-list, find the todo_id of the target to-do:
wecom-cli todo get_todo_list '{}' - Step 2: Get details through wecomcli-get-todo-detail to confirm it is the target to-do:
wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - Step 3: After confirmation, change the current user's participation status to completed:
wecom-cli todo change_todo_user_status '{"todo_id": "TODO_ID", "user_status": 2}'
How to judge user intent: If the user says "mark as completed" and the to-do is created by himself without other assignees, it usually refers to Scenario A (mark the to-do itself as completed). If the to-do has multiple participants, the user may just want to mark his own part as completed (Scenario B). Confirm with the user when uncertain.
What the user provides is the to-do content description instead of ID, so you need to search and match through wecomcli-get-todo-list and wecomcli-get-todo-detail first. When multiple similar to-dos are matched, list the candidates for the user to confirm.
更新待办内容或提醒时间
Update To-Do Content or Reminder Time
用户问:"把那个需求文档的待办提醒时间改到下周五"
- 第一步:查找目标待办:,再查详情:
wecom-cli todo get_todo_list '{}'wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}' - 第二步:确认目标后更新:
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "remind_time": "2025-03-28 09:00:00"}'
User asks: "Change the reminder time of the requirement document to-do to next Friday"
- Step 1: Find the target to-do: , then query details:
wecom-cli todo get_todo_list '{}'wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}' - Step 2: Update after confirming the target:
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "remind_time": "2025-03-28 09:00:00"}'
删除待办
Delete To-Do
用户问:"删掉'代码评审'那个待办"
- 第一步:查找目标待办:,再查详情:
wecom-cli todo get_todo_list '{}'wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - 第二步:向用户确认后删除:
wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'
删除前必须向用户确认,确认措辞示例:"确认删除待办'代码评审'吗?删除后不可恢复。"
User asks: "Delete the 'Code Review' to-do"
- Step 1: Find the target to-do: , then query details:
wecom-cli todo get_todo_list '{}'wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - Step 2: Delete after confirming with the user:
wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'
You must confirm with the user before deletion, example confirmation wording: "Are you sure to delete the to-do 'Code Review'? It cannot be recovered after deletion."
注意事项
Notes
-
todo_id 来源规则
- 必须来自
todo_id返回的结果,禁止自行推测或构造wecomcli-get-todo-list - 用户通常提供待办内容描述而非 ID,应先通过 wecomcli-get-todo-list 查列表再匹配
- 若匹配到多个相似待办,展示候选列表让用户确认
-
follower_id 来源规则
- 即
follower_id,必须通过userid技能的wecomcli-lookup-contact接口获取get_userlist - 禁止根据用户姓名自行猜测 userid
- 若搜索结果有多个同名人员,展示候选列表让用户选择
-
时间格式
- 所有时间参数使用 格式
YYYY-MM-DD HH:mm:ss - 用户说"明天"、"下周一"等相对时间时,根据当前日期推算具体日期
- 所有时间参数使用
-
状态值含义
- 待办状态():
todo_status-已完成,0-进行中,1-已删除2 - 用户状态():
user_status-拒绝,0-接受,1-已完成2 - 分派人状态():
follower_status-拒绝,0-接受,1-已完成2
- 待办状态(
-
破坏性操作确认
- 删除待办()前必须向用户确认
delete_todo - 变更状态为"拒绝"()前建议向用户确认
user_status=0
- 删除待办(
-
错误处理
- 若 不为
errcode,说明接口调用失败,告知用户0中的错误信息errmsg
- 若
-
follower_list 的格式(作为输入参数的时候)json
"follower_list": { // 分派人列表 "followers": [ // 注意里面还有一层是 "followers",它的value才是真正的列表数组 { "follower_id": "FOLLOWER_ID", // 分派人id "follower_status": 1 // 分派人状态:0-拒绝, 1-接受, 2-已完成 } ] }即 userid,需要通过follower_id查询获取,禁止自行猜测或构造。wecomcli-lookup-contact
-
todo_id Source Rules
- must come from the results returned by
todo_id, speculation or construction by yourself is prohibitedwecomcli-get-todo-list - Users usually provide to-do content descriptions instead of IDs, you should first query the list through wecomcli-get-todo-list and then match
- If multiple similar to-dos are matched, display a candidate list for the user to confirm
-
follower_id Source Rules
- is
follower_id, which must be obtained through theuseridinterface of theget_userlistskillwecomcli-lookup-contact - Guessing userid based on user name is prohibited
- If there are multiple people with the same name in the search results, display a candidate list for the user to choose
-
Time Format
- All time parameters use format
YYYY-MM-DD HH:mm:ss - When users say relative time such as "tomorrow", "next Monday", calculate the specific date based on the current date
- All time parameters use
-
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 (
-
Destructive Operation Confirmation
- You must confirm with the user before deleting a to-do ()
delete_todo - It is recommended to confirm with the user before changing the status to "Reject" ()
user_status=0
- You must confirm with the user before deleting a to-do (
-
Error Handling
- If is not
errcode, it means the interface call failed, inform the user of the error information in0errmsg
- If
-
Format of(when used as an input parameter)
follower_listjson"follower_list": { // Assignee list "followers": [ // Note that there is another layer of "followers" inside, its value is the real list array { "follower_id": "FOLLOWER_ID", // Assignee id "follower_status": 1 // Assignee status: 0-Rejected, 1-Accepted, 2-Completed } ] }is userid, which needs to be obtained throughfollower_idquery, speculation or construction by yourself is prohibited.wecomcli-lookup-contact
相关技能
Related Skills
- 获取待办列表:— 查询待办概要列表,获取 todo_id
wecomcli-get-todo-list - 获取待办详情:— 根据 todo_id 获取完整内容
wecomcli-get-todo-detail - 通讯录查询:的
wecomcli-lookup-contact— 获取成员 userid,用于get_userlistfollower_id
- Get To-Do List: — Query the to-do summary list to get todo_id
wecomcli-get-todo-list - Get To-Do Details: — Get complete content according to todo_id
wecomcli-get-todo-detail - Address Book Query: of
get_userlist— Get member userid forwecomcli-lookup-contactfollower_id