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-cli
对企业微信待办事项进行写操作,支持四种操作:创建待办、更新待办、删除待办、变更用户状态。
wecom-cli
is the official command line program provided by WeCom, all operations are completed by executing
wecom-cli
commands.
Perform write operations on WeCom to-do items via
wecom-cli
, supporting four types of operations: create to-do, update to-do, delete to-do, change user status.

行为策略

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格式的入参>'
参数说明:
需要遵循 “注意事项”中的格式要求:
参数类型必填说明
content
string待办内容
follower_list
object分派人列表,格式见注意事项第 7 条
remind_time
string提醒时间,格式:
YYYY-MM-DD HH:mm:ss
调用示例:
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":
ParameterTypeRequiredDescription
content
stringTo-do content
follower_list
objectAssignee list, see Note 7 for format
remind_time
stringReminder time, format:
YYYY-MM-DD HH:mm:ss
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格式的入参>'
参数说明:
需要遵循 “注意事项”中的格式要求:
参数类型必填说明
todo_id
string待办 ID
content
string新的待办内容
follower_list
object新的分派人列表(全量替换,非追加),格式见注意事项第 7 条。若要新增分派人,需先查出现有分派人,合并后一起提交
todo_status
number新的待办状态:
0
-已完成,
1
-进行中。删除请使用
delete_todo
remind_time
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":
ParameterTypeRequiredDescription
todo_id
stringTo-do ID
content
stringNew to-do content
follower_list
objectNew 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
todo_status
numberNew to-do status:
0
-Completed,
1
-In progress. Use
delete_todo
for deletion
remind_time
stringNew 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格式的入参>'
参数说明:
需要遵循 “注意事项”中的格式要求:
参数类型必填说明
todo_id
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":
ParameterTypeRequiredDescription
todo_id
stringTo-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:
delete_todo
has the same effect as setting
todo_status=2
in
update_todo
,
delete_todo
is preferred.

4. 变更用户待办状态

4. Change User To-Do Status

更改当前用户在某个待办中的状态(拒绝/接受/已完成):
bash
wecom-cli todo change_todo_user_status '<json格式的入参>'
参数说明:
需要遵循 “注意事项”中的格式要求:
参数类型必填说明
todo_id
string待办 ID
user_status
number用户状态:
0
-拒绝,
1
-接受,
2
-已完成
调用示例:
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":
ParameterTypeRequiredDescription
todo_id
stringTo-do ID
user_status
numberUser status:
0
-Rejected,
1
-Accepted,
2
-Completed
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

用户问:"帮我创建一个待办,让张三下周一前完成需求文档"
  1. 第一步:通过 wecomcli-lookup-contact 技能查询张三的 userid,在返回结果中筛选姓名为"张三"的成员,获取其 userid
  2. 第二步:创建待办并分派:
    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"
  1. 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
  2. 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"}'
follower_id
must come from the
userid
returned by the
get_userlist
interface of the
wecomcli-lookup-contact
skill, 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.

标记待办完成

Mark To-Do as Completed

需要区分两种场景:标记待办本身完成(改
todo_status
)和标记我的参与状态为完成(改
user_status
)。
Two scenarios need to be distinguished: Mark the to-do itself as completed (modify
todo_status
) and Mark my participation status as completed (modify
user_status
).

场景 A:标记待办本身完成

Scenario A: Mark the to-do itself as completed

用户问:"把'完成Q2规划文档'这个待办标记为完成" / "关闭这个待办"
  1. 第一步:通过 wecomcli-get-todo-list 获取待办列表,找到目标待办的 todo_id:
    wecom-cli todo get_todo_list '{}'
  2. 第二步:通过 wecomcli-get-todo-detail 获取详情,确认是目标待办:
    wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}'
  3. 第三步:确认后,将待办状态改为已完成:
    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"
  1. 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 '{}'
  2. 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"]}'
  3. 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

用户问:"我已经完成了这个待办" / "标记我的部分为完成"
  1. 第一步:通过 wecomcli-get-todo-list 获取待办列表,找到目标待办的 todo_id:
    wecom-cli todo get_todo_list '{}'
  2. 第二步:通过 wecomcli-get-todo-detail 获取详情,确认是目标待办:
    wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}'
  3. 第三步:确认后,变更当前用户的参与状态为已完成:
    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"
  1. 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 '{}'
  2. 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"]}'
  3. 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

用户问:"把那个需求文档的待办提醒时间改到下周五"
  1. 第一步:查找目标待办:
    wecom-cli todo get_todo_list '{}'
    ,再查详情:
    wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}'
  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"
  1. Step 1: Find the target to-do:
    wecom-cli todo get_todo_list '{}'
    , then query details:
    wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}'
  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

用户问:"删掉'代码评审'那个待办"
  1. 第一步:查找目标待办:
    wecom-cli todo get_todo_list '{}'
    ,再查详情:
    wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}'
  2. 第二步:向用户确认后删除:
    wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'
删除前必须向用户确认,确认措辞示例:"确认删除待办'代码评审'吗?删除后不可恢复。"

User asks: "Delete the 'Code Review' to-do"
  1. Step 1: Find the target to-do:
    wecom-cli todo get_todo_list '{}'
    , then query details:
    wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}'
  2. 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

  1. todo_id 来源规则
    • todo_id
      必须来自
      wecomcli-get-todo-list
      返回的结果,禁止自行推测或构造
    • 用户通常提供待办内容描述而非 ID,应先通过 wecomcli-get-todo-list 查列表再匹配
    • 若匹配到多个相似待办,展示候选列表让用户确认
  2. follower_id 来源规则
    • follower_id
      userid
      ,必须通过
      wecomcli-lookup-contact
      技能的
      get_userlist
      接口获取
    • 禁止根据用户姓名自行猜测 userid
    • 若搜索结果有多个同名人员,展示候选列表让用户选择
  3. 时间格式
    • 所有时间参数使用
      YYYY-MM-DD HH:mm:ss
      格式
    • 用户说"明天"、"下周一"等相对时间时,根据当前日期推算具体日期
  4. 状态值含义
    • 待办状态(
      todo_status
      ):
      0
      -已完成,
      1
      -进行中,
      2
      -已删除
    • 用户状态(
      user_status
      ):
      0
      -拒绝,
      1
      -接受,
      2
      -已完成
    • 分派人状态(
      follower_status
      ):
      0
      -拒绝,
      1
      -接受,
      2
      -已完成
  5. 破坏性操作确认
    • 删除待办(
      delete_todo
      )前必须向用户确认
    • 变更状态为"拒绝"(
      user_status=0
      )前建议向用户确认
  6. 错误处理
    • errcode
      不为
      0
      ,说明接口调用失败,告知用户
      errmsg
      中的错误信息
  7. follower_list 的格式(作为输入参数的时候)
    json
    "follower_list": {                    // 分派人列表
        "followers": [                    // 注意里面还有一层是 "followers",它的value才是真正的列表数组
            {
                "follower_id": "FOLLOWER_ID",      // 分派人id
                "follower_status": 1              // 分派人状态:0-拒绝, 1-接受, 2-已完成
            }
        ]
    }
    follower_id
    即 userid,需要通过
    wecomcli-lookup-contact
    查询获取,禁止自行猜测或构造。
  1. todo_id Source Rules
    • todo_id
      must come from the results returned by
      wecomcli-get-todo-list
      , speculation or construction by yourself is prohibited
    • 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
  2. follower_id Source Rules
    • follower_id
      is
      userid
      , which must be obtained through the
      get_userlist
      interface of the
      wecomcli-lookup-contact
      skill
    • 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
  3. Time Format
    • All time parameters use
      YYYY-MM-DD HH:mm:ss
      format
    • When users say relative time such as "tomorrow", "next Monday", calculate the specific date based on the current date
  4. 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
  5. 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
      )
  6. Error Handling
    • If
      errcode
      is not
      0
      , it means the interface call failed, inform the user of the error information in
      errmsg
  7. Format of
    follower_list
    (when used as an input parameter)
    json
    "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
            }
        ]
    }
    follower_id
    is userid, which needs to be obtained through
    wecomcli-lookup-contact
    query, speculation or construction by yourself is prohibited.

相关技能

Related Skills

  • 获取待办列表
    wecomcli-get-todo-list
    — 查询待办概要列表,获取 todo_id
  • 获取待办详情
    wecomcli-get-todo-detail
    — 根据 todo_id 获取完整内容
  • 通讯录查询
    wecomcli-lookup-contact
    get_userlist
    — 获取成员 userid,用于
    follower_id
  • Get To-Do List:
    wecomcli-get-todo-list
    — Query the to-do summary list to get todo_id
  • Get To-Do Details:
    wecomcli-get-todo-detail
    — Get complete content according to todo_id
  • Address Book Query:
    get_userlist
    of
    wecomcli-lookup-contact
    — Get member userid for
    follower_id