【问题标题】:How to schedule a google meet and get the meet link in NodeJs?如何安排谷歌会议并在 NodeJs 中获取会议链接?
【发布时间】:2022-01-08 16:21:06
【问题描述】:

在我的项目中,我必须在给定时间安排我在 NodeJS 中使用电子邮件 ID 的两个用户之间的谷歌会议。谁能帮我解决这个问题?

【问题讨论】:

  • 我认为当你提供你当前的脚本并解释你的脚本的当前问题时,它会帮助用户思考解决方案。
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: javascript node.js api calendar google-calendar-api


【解决方案1】:

您需要使用Google Calendar API 来创建 Google Meet,这是一个工作代码示例,说明如何操作。

Create a Google Meet Event                                                                                 Run in Fusebit
// You already have the user emails from your NodeJS app
const attendeesEmails = [
  { 'email': 'user1@example.com' },
  { 'email': 'user2@example.com' }
  ];
const event = {
  summary: 'Coding class',
  location: 'Virtual / Google Meet',
  description: 'Learn how to code with Javascript',
  start: {
    dateTime: '2022-01-18T09:00:00-07:00',
    timeZone: 'America/Los_Angeles',
  },
  end: {
    dateTime: '2022-01-18T09:30:00-07:00',
    timeZone: 'America/Los_Angeles',
  },
  attendees: attendeesEmails,
  reminders: {
    useDefault: false,
    overrides: [
      { method: 'email', 'minutes': 24 * 60 },
      { method: 'popup', 'minutes': 10 },
    ],
  },
  conferenceData: {
    createRequest: {
      conferenceSolutionKey: {
        type: 'hangoutsMeet'
      },
      requestId: 'coding-calendar-demo'
    }
  },
};

const response = await calendar.events.insert({
  calendarId: 'primary',
  resource: event,
  conferenceDataVersion: 1
});

const { config: { data: { summary, location, start, end, attendees } }, data: { conferenceData } } = response;

// Get the Google Meet conference URL in order to join the call
const { uri } = conferenceData.entryPoints[0];
console.log(`? Calendar event created: ${summary} at ${location}, from ${start.dateTime} to ${end.dateTime}, attendees:\n${attendees.map(person => `? ${person.email}`).join('\n')} \n ? Join conference call link: ${uri}`);
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-02
    • 1970-01-01
    • 2022-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多