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

自定义Google Meet会议码无法使用:Calendar API创建会议报错咨询

问题:自行生成Google Meet会议码无法正常进入,需遵循哪些规则?

我尝试通过Calendar API创建Google Meet会议,自行生成格式为XXX-YYYY-ZZZ的会议码。会议已成功生成,但进入时收到提示:"请确认你在URL中输入了正确的会议码"。请问生成该会议码需遵循特定规则吗?

以下是我的会议数据代码及会议码生成函数:

会议数据代码

if event.Location.Type == models.LocationTypeGoogle && syncType != SyncTypeCancel {
            confId := stringutils.GenerateRandomIdSuitableForGoogleMeetId()
            link := "meet.google.com/" + confId
            entryPoint := &calendar.EntryPoint{
                Uri:            "https://" + link,
                Label:          link,
                EntryPointType: "video",
            }

            gEvent.ConferenceData = &calendar.ConferenceData{
                ConferenceId: confId,
                ConferenceSolution: &calendar.ConferenceSolution{
                    Key: &calendar.ConferenceSolutionKey{
                        Type: "hangoutsMeet",
                    },
                },
            }
            gEvent.ConferenceData.EntryPoints = append(gEvent.ConferenceData.EntryPoints, entryPoint)

会议码生成函数

const lettersForGoogleMeetId = "abcdefghijklmnopqrstuv"
func GenerateRandomIdSuitableForGoogleMeetId() string {
    return generateRandomString(3, lettersForGoogleMeetId) + "-" + generateRandomString(4, lettersForGoogleMeetId) + "-" + generateRandomString(3, lettersForGoogleMeetId)
}

解答

Google Meet的会议码不能自行手动生成,必须由Google Calendar API的hangoutsMeet会议解决方案自动分配。你遇到的错误正是因为手动构造了会议ID,而非通过API的官方流程生成合法的会议码。

正确的实现方式

不要手动设置ConferenceId和自定义EntryPoint链接,而是通过ConferenceData.CreateRequest字段请求API自动创建会议:

if event.Location.Type == models.LocationTypeGoogle && syncType != SyncTypeCancel {
    gEvent.ConferenceData = &calendar.ConferenceData{
        CreateRequest: &calendar.CreateConferenceRequest{
            ConferenceSolutionKey: &calendar.ConferenceSolutionKey{
                Type: "hangoutsMeet",
            },
            RequestId: stringutils.GenerateRandomString(10), // 生成唯一请求ID,防止重复创建会议
        },
    }
}

API调用成功后,返回的Event对象会包含完整的ConferenceData,其中包括系统自动生成的有效会议码、EntryPoint链接等信息,直接使用这些返回值即可正常进入会议。

补充说明

虽然Google Meet会议码看起来是XXX-YYYY-ZZZ的格式,但内部有严格的校验机制,只有API生成的会议码才会被系统认可为有效。手动生成的即使格式匹配,也无法通过验证,因此会出现会议码无效的提示。


内容的提问来源于stack exchange,提问作者M.Ayoub

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 18:16:38