gws-meeting-scheduler
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMeeting Scheduler
会议调度工具
Find mutual availability and create Google Calendar events using the CLI.
gws使用 CLI查找双方空闲时段并创建Google Calendar事件。
gwsPrerequisites
前提条件
- CLI installed and authenticated
gws
- 已安装并完成CLI的身份验证
gws
Workflow
工作流程
1. Resolve attendee email
1. 获取参会者邮箱
If the user provides a name but no email, search past calendar events:
bash
gws calendar events list --params '{"calendarId":"primary","q":"<name>","maxResults":10}'Look at the array in results to find the matching email. If multiple matches, ask the user to confirm.
attendees如果用户仅提供姓名但未给出邮箱,搜索过往日历事件:
bash
gws calendar events list --params '{"calendarId":"primary","q":"<name>","maxResults":10}'查看结果中的数组以匹配对应的邮箱。如果存在多个匹配结果,请询问用户进行确认。
attendees2. Detect timezones
2. 检测时区
Detect each person's timezone by querying their own calendar directly. When you query a person's calendar via their email as , the API returns with that person's local UTC offset — this is the most reliable signal.
calendarIdstart.dateTimebash
gws calendar events list --params '{"calendarId":"<user-email>","maxResults":10}'
gws calendar events list --params '{"calendarId":"<attendee-email>","maxResults":10}'For each person:
- Look at on non-all-day events (skip events with only
start.dateTime)start.date - Extract the UTC offset (e.g., ,
-08:00) — this reflects their calendar's timezone+09:00 - Tally the most frequent offset to determine their timezone
- Cross-reference with the field on events matching that offset to get the IANA name (e.g.,
start.timeZone→-08:00)America/Los_Angeles
Important: Do NOT rely on alone — it often reflects the organizer's or attendee's timezone rather than the calendar owner's. The offset from the person's own calendar is the source of truth.
start.timeZonedateTimeIf no timezone can be determined for either person, ask the user.
通过直接查询个人日历来检测每个人的时区。当你以邮箱作为查询某人的日历时,API返回的会包含该用户当地的UTC偏移量——这是最可靠的信号。
calendarIdstart.dateTimebash
gws calendar events list --params '{"calendarId":"<user-email>","maxResults":10}'
gws calendar events list --params '{"calendarId":"<attendee-email>","maxResults":10}'针对每个人:
- 查看非全天事件的字段(跳过仅包含
start.dateTime的事件)start.date - 提取UTC偏移量(例如、
-08:00)——这反映了该用户日历的时区+09:00 - 统计出现频率最高的偏移量以确定其时区
- 对照匹配该偏移量的事件中的字段,获取IANA时区名称(例如
start.timeZone对应-08:00)America/Los_Angeles
重要提示: 不要仅依赖字段——它通常反映的是组织者或参会者的时区,而非日历所有者的时区。从个人日历获取的偏移量才是最准确的依据。
start.timeZonedateTime如果无法确定任何一方的时区,请询问用户。
3. Determine date range
3. 确定日期范围
Ask the user for a preferred date range, or default to the next 5 business days.
询问用户偏好的日期范围,默认设置为未来5个工作日。
4. Check free/busy
4. 查看空闲/忙碌状态
Query both calendars together. The query range must cover work hours in both timezones:
bash
gws calendar freebusy query --json '{
"timeMin": "<start-RFC3339>",
"timeMax": "<end-RFC3339>",
"items": [{"id": "<user-email>"}, {"id": "<attendee-email>"}]
}'同时查询双方日历。查询范围必须覆盖双方时区的工作时间:
bash
gws calendar freebusy query --json '{
"timeMin": "<start-RFC3339>",
"timeMax": "<end-RFC3339>",
"items": [{"id": "<user-email>"}, {"id": "<attendee-email>"}]
}'5. Compute overlapping free slots
5. 计算重叠的空闲时段
- Convert all busy times from UTC to each person's timezone
- Define work hours per person: 9:00-18:00 in their respective timezone
- Find the overlap of both people's work-hour windows, then subtract combined busy blocks
- Filter to slots >= requested meeting duration
- Double-check every slot against BOTH calendars before presenting — do not skip the user's own busy times
- Present slots as a table showing times in both timezones:
Day | User (JST) | Attendee (PST) | Duration
Thu Feb 26 | 15:00 - 16:00 | 22:00 - 23:00 | 1hIf work-hour overlap is very limited (e.g., < 1 hour), note this and suggest the user consider extending hours.
- 将所有忙碌时间从UTC格式转换为每个人的本地时区
- 定义每个人的工作时间:各自时区的9:00-18:00
- 找出双方工作时间窗口的重叠部分,再减去共同的忙碌时段
- 筛选出时长大于等于会议需求的时段
- 展示前务必对照双方日历验证每个时段——不要忽略用户本人的忙碌时间
- 以表格形式展示时段,同时显示双方时区的时间:
日期 | 用户(JST) | 参会者(PST) | 时长
2月26日周四 | 15:00 - 16:00 | 22:00 - 23:00 | 1小时如果工作时间重叠非常有限(例如不足1小时),请告知用户并建议考虑延长工作时间。
6. Confirm and create the event
6. 确认并创建事件
Once the user picks a slot, duration, and title:
bash
gws calendar +insert \
--summary "<title>" \
--start "<start-RFC3339>" --end "<end-RFC3339>" \
--attendee "<user-email>" --attendee "<attendee-email>"For Google Meet links or other advanced options, use the raw API instead:
bash
gws calendar events insert --params '{"calendarId":"primary","conferenceDataVersion":1,"sendUpdates":"all"}' \
--json '{
"summary": "<title>",
"start": {"dateTime": "<start-RFC3339>"},
"end": {"dateTime": "<end-RFC3339>"},
"attendees": [{"email": "<user-email>"}, {"email": "<attendee-email>"}],
"conferenceData": {"createRequest": {"requestId": "<unique-id>", "conferenceSolutionKey": {"type": "hangoutsMeet"}}}
}'Key notes:
- — repeat for each attendee, always include the user themselves
--attendee - param required when adding Meet links
conferenceDataVersion=1 - — notify attendees via email
sendUpdates=all
一旦用户选定时段、时长和标题:
bash
gws calendar +insert \
--summary "<title>" \
--start "<start-RFC3339>" --end "<end-RFC3339>" \
--attendee "<user-email>" --attendee "<attendee-email>"如需添加Google Meet链接或其他高级选项,请使用原生API:
bash
gws calendar events insert --params '{"calendarId":"primary","conferenceDataVersion":1,"sendUpdates":"all"}' \
--json '{
"summary": "<title>",
"start": {"dateTime": "<start-RFC3339>"},
"end": {"dateTime": "<end-RFC3339>"},
"attendees": [{"email": "<user-email>"}, {"email": "<attendee-email>"}],
"conferenceData": {"createRequest": {"requestId": "<unique-id>", "conferenceSolutionKey": {"type": "hangoutsMeet"}}}
}'关键说明:
- —— 每个参会者重复添加,务必包含用户本人
--attendee - 添加Meet链接时必须传递参数
conferenceDataVersion=1 - —— 通过邮件通知所有参会者
sendUpdates=all
7. Confirm to user
7. 向用户确认
Show: title, date/time (in both timezones if cross-timezone), attendees, and Meet link.
展示信息:标题、日期/时间(跨时区会议需显示双方时区)、参会者及Meet链接。
Important Notes
重要注意事项
- Always include the user as an attendee, not just as the calendar owner
- uses
gwsfor query/path parameters and--paramsfor request bodies--json - Use (or omit, as JSON is default) for reliable parsing
--format json - RFC3339 times must include timezone offset (e.g., for JST)
+09:00 - The freebusy API returns busy times in UTC — convert carefully
- When computing free slots, verify against both calendars before presenting
- Use helper for simple events; use
gws calendar +insertraw API for advanced features (Meet links, recurrence, etc.)gws calendar events insert
- 务必将用户本人作为参会者添加,而不仅仅是作为日历所有者
- 使用
gws传递查询/路径参数,使用--params传递请求体--json - 使用(或省略,因为JSON是默认格式)以确保解析可靠
--format json - RFC3339格式的时间必须包含时区偏移量(例如,JST对应)
+09:00 - 空闲/忙碌API返回的忙碌时间为UTC格式——转换时需谨慎
- 在计算空闲时段时,展示前务必对照双方日历进行验证
- 简单事件使用辅助命令;高级功能(如Meet链接、重复会议等)使用
gws calendar +insert原生APIgws calendar events insert