wecom-cliis a command-line program provided by WeCom. All operations are completed by executing thewecom-clicommand.
Use wecom-cli to perform write operations on WeCom todos, supporting four operations: create todo, update todo, delete todo, and change user status.
Behavior Strategy
Retry Strategy: When encountering "returned HTTP error" or "HTTP request failed", actively retry, with a maximum of three retries.
Operations
1. Create Todo
Create a new todo item, with the content, assignee, and reminder time optionally specified:
wecom-cli todo create_todo '<json格式的入参>'
Parameter Description:
The format requirements in "Precautions" must be followed:
| Parameter | Type | Required | Description |
|---|---|---|---|
content |
string | ✅ | Todo content |
follower_list |
object | ❌ | Assignee list, format see Precautions item 7 |
remind_time |
string | ❌ | Reminder time, format:YYYY-MM-DD HH:mm:ss |
Example call:
wecom-cli todo create_todo '{"content": "<待办的内容>", "remind_time": "2025-06-01 09:00:00"}'
Return format:
{
"errcode": 0,
"errmsg": "ok",
"todo_id": "TODO_ID"
}
2. Update Todo
Modify the content, assignee, status, or reminder time of an existing todo item:
wecom-cli todo update_todo '<json格式的入参>'
Parameter Description:
The format requirements in "Precautions" must be followed:
| Parameter | Type | Required | Description |
|---|---|---|---|
todo_id |
string | ✅ | Todo ID |
content |
string | ❌ | New todo content |
follower_list |
object | ❌ | New assignee list (full replacement, not addition), format see Precautions item 7. To add assignees, first retrieve the existing assignees, merge them, and submit them together |
todo_status |
number | ❌ | New todo status:0-Completed,1-In progress. To delete, use delete_todo |
remind_time |
string | ❌ | New reminder time |
Example call:
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "content": "<待办的内容>", "remind_time": "2025-07-01 09:00:00"}'
Return format:
{
"errcode": 0,
"errmsg": "ok"
}
3. Delete Todo
Delete the specified todo item:
wecom-cli todo delete_todo '<json格式的入参>'
Parameter Description:
The format requirements in "Precautions" must be followed:
| Parameter | Type | Required | Description |
|---|---|---|---|
todo_id |
string | ✅ | Todo ID |
Example call:
wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'
Return format:
{
"errcode": 0,
"errmsg": "ok"
}
The delete operation cannot be undone; confirm with the user before executing. Note:
delete_todoandupdate_todosettingtodo_status=2have the same effect; preferdelete_todo。
4. Change User Todo Status
Change the current user's status in a todo (reject/accept/complete):
wecom-cli todo change_todo_user_status '<json格式的入参>'
Parameter Description:
The format requirements in "Precautions" must be followed:
| Parameter | Type | Required | Description |
|---|---|---|---|
todo_id |
string | ✅ | Todo ID |
user_status |
number | ✅ | User status:0-Rejected,1-Accepted,2-Completed |
Example call:
wecom-cli todo change_todo_user_status '{"todo_id": "TODO_ID", "user_status": 2}'
Return format:
{
"errcode": 0,
"errmsg": "ok"
}
Typical workflow
Create a to-do and assign it to a colleague
User asks: "Help me create a to-do and have Zhang San finish the requirements document by next Monday"
- Step 1: Use the wecomcli-lookup-contact skill to look up Zhang San's userid; filter the returned results for the member whose name is "Zhang San" and get their userid
- Step 2: Create the to-do and assign it:
wecom-cli todo create_todo '{"content": "<待办的内容>", "follower_list": {"followers": [{"follower_id": "zhangsan", "follower_status": 1}]}, "remind_time": "2025-03-24 09:00:00"}'
follower_idmust come from thewecomcli-lookup-contactskill'sget_userlistreturned by theuseridinterface; guessing on your own is prohibited. If the search results contain multiple people with the same name, display the candidate list for the user to confirm.
Mark a to-do as completed
Two scenarios need to be distinguished:Mark the to-do itself as completed(change todo_status) andMark my participation status as completed(change user_status)。
Scenario A: Mark the to-do itself as completed
User asks: "Mark the to-do 'Complete the Q2 planning document' as completed" / "Close this to-do"
- Step 1: Use wecomcli-get-todo-list to get the to-do list and find the todo_id of the target to-do:
wecom-cli todo get_todo_list '{}' - Step 2: Use wecomcli-get-todo-detail to get the details and 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}'
Scenario B: Mark my participation status as completed
User asks: "I have completed this to-do" / "Mark my part as completed"
- Step 1: Use wecomcli-get-todo-list to get the to-do list and find the todo_id of the target to-do:
wecom-cli todo get_todo_list '{}' - Step 2: Use wecomcli-get-todo-detail to get the details and 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 determine user intent: If the user says "mark as completed" and the to-do was created by themselves and has no 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 only want to mark their own part as completed (Scenario B). When uncertain, confirm with the user.
The user provided a to-do content description rather than an ID, so you need to first search via wecomcli-get-todo-list and wecomcli-get-todo-detail and then match. When multiple similar to-dos are matched, list the candidates for the user to confirm.
Update to-do content or reminder time
User asks: "Change the reminder time of that requirements document to-do to next Friday"
- Step 1: Find the target to-do:
wecom-cli todo get_todo_list '{}', then check the details:wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID_1", "TODO_ID_2"]}' - Step 2: After confirming the target, update:
wecom-cli todo update_todo '{"todo_id": "TODO_ID", "remind_time": "2025-03-28 09:00:00"}'
Delete a to-do
User asks: "Delete the to-do 'Code Review'"
- Step 1: Find the target to-do:
wecom-cli todo get_todo_list '{}', then check the details:wecom-cli todo get_todo_detail '{"todo_id_list": ["TODO_ID"]}' - Step 2: After confirming with the user, delete:
wecom-cli todo delete_todo '{"todo_id": "TODO_ID"}'
Before deleting, you must confirm with the user. Example confirmation wording: "Confirm deleting the to-do 'Code Review'? It cannot be recovered after deletion."
Notes
-
todo_id source rule
todo_idmust come from the results returned bywecomcli-get-todo-list; guessing or constructing it on your own is prohibited- Users usually provide a to-do content description rather than an ID, so you should first query the list via wecomcli-get-todo-list and then match
- If multiple similar todos are matched, display a candidate list for the user to confirm
-
follower_id source rules
follower_idi.e.userid, must be obtained through thewecomcli-lookup-contactskill'sget_userlistinterface- Do not guess the userid based on the user's name
- If the search results contain multiple people with the same name, display a candidate list for the user to choose from
-
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
- All time parameters use the
-
Meaning of status values
- Todo 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
- Todo status (
-
Destructive operation confirmation
- Before deleting a todo (
delete_todo), you must confirm with the user - Before changing the status to "rejected" (
user_status=0), it is recommended to confirm with the user
- Before deleting a todo (
-
Error handling
- If
errcodeis not0, it indicates the interface call failed; inform the user of the error message inerrmsgerror message in
- If
-
follower_list format (when used as an input parameter)
"follower_list": { // 分派人列表 "followers": [ // 注意里面还有一层是 "followers",它的value才是真正的列表数组 { "follower_id": "FOLLOWER_ID", // 分派人id "follower_status": 1 // 分派人状态:0-拒绝, 1-接受, 2-已完成 } ] }follower_idi.e. userid, which must be obtained via awecomcli-lookup-contactquery; guessing or constructing it yourself is prohibited.
Related skills
- Get todo list:
wecomcli-get-todo-list— Query the todo summary list to get the todo_id - Get todo details:
wecomcli-get-todo-detail— Get the full content based on the todo_id - Contacts query:
wecomcli-lookup-contact'sget_userlist— Get the member userid, used forfollower_id