使用Google Calendar API获取会议链接 [英] Get meeting link with Google calendar api
问题描述
我希望为应用程序使用Google Calendar API,但我想获得一个Google Meet链接(用于G Suite帐户).据我所知,该选项是不可能的,还是我错了?
I'm looking to use the Google calendar API for an application, but I'd like to get a Google meet link (for a G Suite account). As far as I can see that option is not possible, or am I wrong?
提前谢谢!
推荐答案
根据 https://cloud.google.com/blog/products/application-development/hangouts-meet-now-available-in-google
您需要在ConferenceData.entryPoints []中使用entryPointType = "video"
搜索元素,然后可以使用matchedObject.uri获取Google Meet链接.
You need to search for element with entryPointType = "video"
in ConferenceData.entryPoints[] and then you can use matchedObject.uri to get the Google meet link.
在Javascript/nodejs中,解决方案类似于:
In Javascript / nodejs the solution will be something similar to:
var {google} = require('googleapis');
const eventId = "<yourEventId>";
const calendarId = "<yourCalendarId>";
const calendar = google.calendar({
version : "v3",
auth : auth
});
calendar.events.get({
calendarId,
eventId
}, ( err, res ) => {
if( err ) {
console.log( err );
} else {
const conferenceData = res.conferenceData;
if( conferenceData ) {
const entryPoints = conferenceData.entryPoints;
if( entryPoints ) {
const videoDetails = entryPoints.find( entryPoint => entryPoint.entryPointType == "video" );
if( videoDetails ) {
console.log( "Google Meet link", videoDetails.uri );
} else {
console.log( "No video details available" );
}
} else {
console.log( "No entry points available" );
}
} else {
console.log( "No conference data available" );
}
}
});
这篇关于使用Google Calendar API获取会议链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!