api 更新后获取环聊链接

Get HangoutLink after api update

这是我从 google-calendar-api 检索数据的方式: 我最近添加了 conferenceDataVersion=1,但没有什么不同。

const uri = `${googleapiURL}/calendar/v3/calendars/${calendarId}/events?conferenceDataVersion=1`;

const response = await rp.post({
  uri,
  headers: {
    authorization: `Bearer ${token}`,
  },
  body,
  json: true,
  simple: false,
  resolveWithFullResponse: true,
});

我以前可以通过以下方式进行视频群聊:

const link = response.body.hangoutLink,

但是现在 body 中没有 hangoutLink 属性了。我怎样才能得到它?

我正在阅读 the documentation 关于正文请求查询参数的内容。有一个 conferenceData 但没有如何使用它的示例。

2020 年 9 月之后。Google 日历 API 已更改,不再默认创建会议。我们需要明确地“告诉”我们想要创建一个聚会(视频群聊 link)。

1 - 首先,我们需要添加一个查询参数 conferenceDataVersion=1

2 - 我们需要向请求正文添加一个新的object。

conferenceData: {
  createRequest: {
    conferenceSolutionKey: {
      type: 'hangoutsMeet',
    },
    requestId: <<randomString>>,
  },
}

更多信息:

根据 Events: insert and the Event resource reperesentation 的文档:

conferenceDataVersion: integer

Version number of conference data supported by the API client. Version 0 assumes no conference data support and ignores conference data in the event's body. Version 1 enables support for copying of ConferenceData as well as for creating new conferences using the createRequest field of conferenceData. The default is 0. Acceptable values are 0 to 1, inclusive.


conferenceData.createRequest: nested object

A request to generate a new conference and attach it to the event. The data is generated asynchronously. To see whether the data is present check the status field.

Either conferenceSolution and at least one entryPoint, or createRequest is required.


conferenceData.createRequest.conferenceSolutionKey.type: string

The conference solution type.

If a client encounters an unfamiliar or empty type, it should still be able to display the entry points. However, it should disallow modifications.

The possible values are:


conferenceData.createRequest.requestId: string

The client-generated unique ID for this request. Clients should regenerate this ID for every new request. If an ID provided is the same as for the previous request, the request is ignored.

利用这些信息,我们可以生成一个日历事件创建请求,并以 Meet link 作为会议解决方案。

我对随机字符串的解决方案是生成一个 uuid