You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Calendar API更新后无法获取hangoutLink,如何正确获取Hangout链接?

修复步骤

  1. 仅添加conferenceDataVersion=1查询参数无法触发会议链接生成,需要在请求body中补充conferenceData字段,明确要求创建Hangouts Meet会议,字段结构如下:
const body = {
  // 原有事件基础配置(标题、时间、参会人等)保持不变
  conferenceData: {
    createRequest: {
      // 填写任意唯一字符串即可,用于幂等校验
      requestId: `meet_req_${Date.now()}`,
      conferenceSolutionKey: {
        type: "hangoutsMeet"
      }
    }
  }
}
  1. 完整请求示例(和现有代码逻辑对齐):
const uri = `${googleapiURL}/calendar/v3/calendars/${calendarId}/events?conferenceDataVersion=1`;

const response = await rp.post({
  uri,
  headers: {
    authorization: `Bearer ${token}`,
  },
  // 传入补充了conferenceData的body
  body,
  json: true,
  simple: false,
  resolveWithFullResponse: true,
});
  1. 获取会议链接的两种方式:
// 方式1:原有写法依然可用,生成会议后响应会自动带上hangoutLink字段
const link = response.body.hangoutLink;

// 方式2:从conferenceData字段中提取,兼容性更高
const meetLink = response.body.conferenceData?.entryPoints?.find(item => item.entryPointType === 'video')?.uri;

注意事项

  • 请求所用的OAuth令牌必须持有https://www.googleapis.com/auth/calendar或https://www.googleapis.com/auth/calendar.events权限,权限不足会导致会议生成失败,不会返回对应字段
  • 每次创建新会议需要更换requestId的值,使用重复的requestId不会生成新的会议链接

内容的提问来源于stack exchange,提问作者PlayHardGoPro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 02:36:04