NodeJS 使用Google API创建包含会议的Google日历事件

3wabscal  于 2023-06-22  发布在  Node.js
关注(0)|答案(1)|浏览(128)

我正在尝试通过我的NodeJS应用程序创建Google日历事件。下面的代码可以正常工作,并按预期创建了一个事件,但没有会议。响应没有任何错误或有关会议的相关信息,它只是不存在。

response = await calendar.events.insert({
  auth : oauth2Client,
  calendarId : req.body.user,
  requestBody : {
    summary : summary,
    description : description,
    location : location,
    colorId : "6",
    start : {dateTime : new Date(startDateTime)},
    end : {dateTime : new Date(endDateTime)},
    attendees : attendees,
    sendNotifications : true,
    conferenceDataVersion : 1,
    conferenceData : {
      createRequest :
          {conferenceSolutionKey : {type : "hangoutsMeet"}, requestId : id}
    },
  }
});
1cosmwyk

1cosmwyk1#

我把它修好了。我将conferenceDataVersion移到了请求体之外。

const event = {
            summary: summary,
            description: description,
            location: location,
            colorId: "6",
            start: {
                dateTime: new Date(startDateTime)
            },
            end: {
                dateTime: new Date(endDateTime)
            },
            attendees: attendees,
            sendNotifications: true,
            conferenceData: {
                createRequest: {
                    conferenceSolutionKey: {
                        type: "hangoutsMeet"
                    },
                    requestId: id
                }
            },
        }
        response = await calendar.events.insert({
            auth: oauth2Client,
            calendarId: req.body.user,
            resource: event,
            conferenceDataVersion: 1
        });

相关问题