简体   繁体   中英

How to schedule a google meet and get the meet link in NodeJs?

In my project I have to schedule a google meet at a given time between two users whose email id I am having in NodeJS. Can anyone help me regarding this?

You will need to use Google Calendar API in order to create a Google Meet, here is a working code example of how to do it.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM