Node.js调用Google Calendar API添加Google Meet链接失败求助
解决Google Calendar API添加Google Meet链接失败的问题
错误原因分析
首次请求(返回200但无会议链接):
- 错误地在
conferenceData下直接定义conferenceSolution,创建Meet链接需要通过createRequest触发API自动生成会议,无需手动指定conferenceSolution。
- 错误地在
第二次请求(返回400错误):
- 使用了过时的会议类型值
"hangoutsMeet",当前Google Calendar API要求Google Meet的类型值为"googleMeet"。
- 使用了过时的会议类型值
正确的请求代码示例
const response = await calendar.events.patch({ auth: auth, calendarId: calendarId, eventId: "6df3sea0jhl6tueoos4qjr41a0", requestBody: { conferenceData: { createRequest: { requestId: "unique-request-id-123", // 确保每次请求使用唯一字符串 conferenceSolutionKey: { type: "googleMeet" // 使用正确的会议类型值 } } } }, sendNotifications: true, conferenceDataVersion: 1 // 必须设置为1,否则会议数据不会被处理 });
额外注意事项
- requestId唯一性:每次创建会议请求的
requestId必须是唯一字符串,避免重复请求引发的异常。 - 服务账号权限:确保服务账号已被授予
https://www.googleapis.com/auth/calendar.events权限,且目标日历已共享给该服务账号(或通过域范围委派获取访问权限)。 - 客户端库版本:确认使用的Google Calendar API客户端库为最新版本,避免旧版本兼容性问题。
内容的提问来源于stack exchange,提问作者Algorithm Unlock
相关产品推荐
相关产品推荐

