问题描述
我需要实现一个javascript项目,该项目根据登录的用户创建一个新的Google Meet,并将事件添加到日历中并获取Google Meet的网址.如何在JS中使用Google Calendar API创建新的Google Meet.
I need implement a javascript project that creates a new google meet according to the user signed in and adds the event to the calendar and gets the url of the google meet. How can i create a new google meet using Google Calendar API in JS.
推荐答案
答案:
创建Calendar时,您需要使用Events资源的 conferenceData.createRequest
参数.Events:插入请求以将Meet链接添加到Calendar Event.
Answer:
You need to use the conferenceData.createRequest
parameter of the Events resource when creating a Calendar.Events: insert request to add a Meet link to a Calendar Event.
根据事件:插入和事件资源表述:
conferenceData.createRequest
: 嵌套对象
conferenceSolution
和至少一个 entryPoint
或 createRequest
是必需的.
Either conferenceSolution
and at least one entryPoint
, or createRequest
is required.
conferenceData.createRequest.conferenceSolutionKey.type
: string
如果客户端遇到不熟悉或为空的类型,则它仍应能够显示入口点.但是,应该禁止修改.
If a client encounters an unfamiliar or empty type, it should still be able to display the entry points. However, it should disallow modifications.
可能的值为:
- "
eventHangout
"消费者环聊( http://hangouts.google.com ) - "
eventNamedHangout
"适用于G Suite用户的传统环聊( http://hangouts.google.com ) - "
hangoutsMeet
"适用于Google Meet( http://meet.google.com ) - "
addOn
"适用于3P会议提供商
- "
eventHangout
" for Hangouts for consumers (http://hangouts.google.com) - "
eventNamedHangout
" for classic Hangouts for G Suite users (http://hangouts.google.com) - "
hangoutsMeet
" for Google Meet (http://meet.google.com) - "
addOn
" for 3P conference providers
conferenceData.createRequest.requestId
: string
使用此信息,我们可以生成带有会议"链接的日历事件创建请求作为会议解决方案.
With this information we can generate a Calendar Event creation request with a Meet link as the conference solution.
gapi.client.calendar.events.insert({
"calendarId": "primary",
"conferenceDataVersion": 1,
"resource": {
"end": {
"date": "2020-10-24"
},
"start": {
"date": "2020-10-23"
},
"conferenceData": {
"createRequest": {
"conferenceSolutionKey": {
"type": "hangoutsMeet"
},
"requestId": "some-random-string"
}
},
"summary": "titles are cool"
}
});
注意::要生成会议链接,您 必须 设置 conferenceData.createRequest.requestId
来 任何随机字符串 .对于您要创建的每个新的见面链接,必须在请求中使用 不同的字符串 .
NB: In order for a Meet link to be generated, you must set conferenceData.createRequest.requestId
to any random string. For each new meet link you wish to create, you must use a different string in the request.
希望对您有帮助!
这篇关于如何使用Google Calendar API创建新的Google Meet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!