wecom-cliis a command-line program provided by WeCom. All operations are completed by executingwecom-clicommands.
Through wecom-cli schedule <接口名> '<json入参>' to interact with the WeCom schedule system.
Notes
- Schedule list queries only support30 days before and after the current day, time format
YYYY-MM-DDorYYYY-MM-DD HH:MM:SS - When participants' userids are involved, first use the wecomcli-lookup-contact skill to obtain them; if there are duplicate names, show candidates for the user to choose (do not expose userid)
- Before creating/modifying/canceling, first confirm the target schedule and participant information
errcode != 0display an error message when ; the returnedstart_time/end_timeis a Unix timestamp (seconds), which needs to be converted to a readable format- Pay attention to time format conversion: API input parameters use string format (such as
YYYY-MM-DD HH:MM:SS), but return values are mostly Unix timestamps, and format conversion is required when using them
API list
get_schedule_list_by_range — query schedule ID list
wecom-cli schedule get_schedule_list_by_range '{"start_time": "YYYY-MM-DD HH:MM:SS", "end_time": "YYYY-MM-DD HH:MM:SS"}'
Return schedule_id_list array. Only supports 30 days before and after the current day.
get_schedule_detail — get schedule details
wecom-cli schedule get_schedule_detail '{"schedule_id_list": ["SCHEDULE_ID_1", "SCHEDULE_ID_2"]}'
Supports 1~50 IDs, returns schedule title, time, location, participants, etc. See API details。
create_schedule — create schedule
wecom-cli schedule create_schedule '{"schedule": {"start_time": "YYYY-MM-DD HH:MM:SS", "end_time": "YYYY-MM-DD HH:MM:SS", "summary": "日程标题", "attendees": [{"userid": "USER_ID"}], "reminders": {"is_remind": 1, "remind_before_event_secs": 3600, "timezone": 8}}}'
See API details | reminders field。
update_schedule — modify schedule
Only pass in the fields to be modified; fields not passed remain unchanged.
wecom-cli schedule update_schedule '{"schedule": {"schedule_id": "SCHEDULE_ID", "summary": "更新后的标题"}}'
See API details。
cancel_schedule — cancel schedule
wecom-cli schedule cancel_schedule '{"schedule_id": "SCHEDULE_ID"}'
add_schedule_attendees / del_schedule_attendees — manage participants
- Add participants:
wecom-cli schedule add_schedule_attendees '{"schedule_id": "SCHEDULE_ID", "attendees": [{"userid": "USER_ID"}]}'
- Remove participants:
wecom-cli schedule del_schedule_attendees '{"schedule_id": "SCHEDULE_ID", "attendees": [{"userid": "USER_ID"}]}'
check_availability — query free/busy
wecom-cli schedule check_availability '{"check_user_list": ["USER_ID_1", "USER_ID_2"], "start_time": "YYYY-MM-DD HH:MM:SS", "end_time": "YYYY-MM-DD HH:MM:SS"}'
Supports 1~10 users, returns each user's list of busy periods. See API details。
Typical workflow
Query schedules
Classic query examples:
- "What schedules do I have today?"
- "Help me check whether there is a meeting this Wednesday afternoon"
- "What is tomorrow's schedule?"
- "Check whether there are any schedules about project review recently"
- "What schedules do I have from next Monday to Friday?"
Process:
- Calculate the time range according to the user's intent (e.g., "today"→00:00:00 to 23:59:59 of the current day, "this week"→Monday to Sunday of this week)
- Call
get_schedule_list_by_rangeto get the schedule ID list - Call
get_schedule_detailto batch retrieve details, and convert Unix timestamps to readable time - If the user mentions keywords (such as "project review"), match and filter in
summary; if not found, gradually expand the range up to the upper limit of 30 days before and after - When displaying the schedule list, include key information such as title, time, location, and participants, so users can quickly understand
Create schedule
Classic query examples:
- "Help me create a meeting from 2 PM to 3 PM tomorrow afternoon, titled Requirements Review"
- "Arrange a full-day team-building activity on Friday"
- "Create a schedule: have a product plan discussion with Zhang San and Li Si at 10 AM the day after tomorrow, location is the 3rd-floor meeting room"
- "Help me create a schedule, next Monday 14:00-15:00, remind me 15 minutes in advance"
- "Schedule an appointment for tomorrow morning, invite Wang Wei to attend"
Process:
- Parse the user's intent and extract information such as time, title, location, participants, and reminder settings
- If participants are involved, first use wecomcli-lookup-contact to query the userid; if there are people with the same name, display candidates for the user to choose
- If the user does not specify a reminder, set a reminder 15 minutes in advance by default (
remind_before_event_secs: 900) - If the user says "all day", set
is_whole_day: 1, and set the time from 00:00:00 to 23:59:59 on that day - After confirming the schedule information with the user (title, time, location, participants, etc.), call
create_schedule
Modify schedule
Classic query examples:
- "Move tomorrow's Requirements Review to 3 PM the day after tomorrow"
- "Help me modify the title of this afternoon's meeting to Technical Plan Review"
- "Change the location of my 14:00 schedule today to an online Tencent Meeting"
- "Postpone Friday's team-building activity by one hour"
- "Help me add a description to tomorrow's weekly meeting: discuss Q2 planning"
Process:
- First locate the target schedule through the query workflow (match based on keywords such as the time and title mentioned by the user)
- If multiple schedules are matched, display a candidate list for the user to confirm
- Confirm with the user the fields to be modified and the target values
- Call
update_schedule, and pass in only the fields that need to be modified
Cancel schedule
Classic query examples:
- "Cancel tomorrow afternoon's Requirements Review"
- "Help me delete Friday's team-building schedule"
- "I don't want to have the 15:00 meeting today anymore, help me cancel it"
Process:
- First locate the target schedule through the query workflow
- Confirm with the user the schedule information to be canceled (title, time, etc.) to avoid accidental operations
- After confirmation, call
cancel_schedule
Manage participants
Classic query examples:
- "Add Zhang San to tomorrow's Requirements Review meeting"
- "Help me remove Li Si from Friday's schedule"
- "Invite Wang Wei and Zhao Min again to tomorrow afternoon's meeting"
- "Remove Liu Qiang from the participants of my technical sharing the day after tomorrow"
Process:
- Use wecomcli-lookup-contact to get the target person's userid; if there are people with the same name, display candidates for the user to choose
- Locate the target schedule through the query workflow
- Call
add_schedule_attendeesordel_schedule_attendeesto complete adding/removing
Query availability and arrange a meeting
Classic query examples:
- "Help me check whether Zhang San and Li Si are free tomorrow afternoon"
- "Check my and Wang Wei's free time this week, I want to schedule a meeting"
- "I want to have a meeting with Xiao Ming and Xiao Hong from the product team to see when everyone is available"
- "Find a time slot tomorrow afternoon when everyone is available and schedule a 1-hour meeting"
Process:
- Via wecomcli-lookup-contact get the userids of the relevant people
- Call
check_availabilityto query each user's busy time slots within the specified time range - Analyze all users' busy time slots, calculate the common free time slots, and recommend them to the user
- After the user confirms the time slot, call
create_scheduleto create the meeting and automatically add the participants