获取与Google日历API的会议链接

时间:2017-06-24 16:47:11

标签: google-api google-calendar-api

我希望将Google日历API用于应用程序,但我希望获得Google会议链接(适用于G Suite帐户)。据我所知,这个选项是不可能的,或者我错了吗?

提前致谢!

2 个答案:

答案 0 :(得分:2)

根据https://cloud.google.com/blog/products/application-development/hangouts-meet-now-available-in-google

您需要在ConferenceData.entryPoints []中使用entryPointType = "video"搜索元素,然后可以使用matchedObject.uri获取Google Meet链接。

在Javascript / nodejs中,解决方案类似于:

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" );
        }
    }
});

答案 1 :(得分:0)

截至目前,日历API中只有hangoutLink。如果您想知道如何在Javascript中使用它,请检查this guide