npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

google-calendar-free-slots-schedular

v1.0.0

Published

google calendar free slots meetings schedular

Downloads

10

Readme

google-calendar-free-slots-scheduler

Google Calendar Free Slots Scheduler is a package that provides a simple way to schedule meetings on Google Calendar by finding free slots in the calendars of attendees and checking for availability during specific time frame and handle the timeZone working hours issues and also can save you valuable time and effort in the scheduling process and ensure that everyone involved can find a suitable time to meet.

Installation

Install the package using npm by running the following command in your terminal:

npm install google-calendar-free-slots-scheduler

After Installation

Follow these steps:

  • Setup you google service account.
  • Enable the google calendar API.
  • Link google service account with google admin console.

Usage

Getting all modules in one object

The top-level export gives you an object with all three modules:

var meetingSchedular = require('google-calendar-free-slots-schedular');

Getting a specific module

If you only want the scheduleCalendarMeetings, getUsersFreeSlots, or createCalendarMeeting module:

var scheduleCalendarMeetings = require('google-calendar-free-slots-schedular').scheduleCalendarMeetings;
var getUsersFreeSlots = require('google-calendar-free-slots-schedular').getUsersFreeSlots;
var createCalendarMeeting = require('google-calendar-free-slots-schedular').createCalendarMeeting;

API

ScheduleCalendarMeetings

scheduleCalendarMeetings is used to get the free slots of all participants and schedule the meeting within a specific time frame and timezone working hours.

Params

  • meetings {Array}: An array of meeting objects with the necessary parameters, including the title, description, organizedEmail, attendeesEmail, startDay, endDay, duration, and usersAvailabilityStartDate
  • SERVICE_ACCOUNT_CLIENT_EMAIL {String}: The email address of the service account used for authentication
  • SERVICE_ACCOUNT_PRIVATE_KEY {String}: The private key of the service account used for authentication.
  • ORGANIZATION_ADMIN_EMAIL {String}: The email address of the organization admin whose Google Calendar will be
  • used for scheduling the meetings.
  • returns {Array}: Scheduled Google meeting data.

Example

const {googleCalendar} = require('google-calendar-free-slots-scheduler');

const meetings = [
    {
        title: 'Example Meeting',
        description: 'This is an example meeting',
        organizedEmail: '[email protected]',
        attendeesEmail: ['[email protected]', '[email protected]'],
        startDay: 1, // start Day
        endDay: 7, // end day
        duration: '30', // duration of meeting in minutes
        usersAvailabilityStartDate: '2022-12-15', // start date for scheduleCalendarMeetings to find the meeting slots between given start and end day 
    },
];

const SERVICE_ACCOUNT_CLIENT_EMAIL = '[email protected]';
const SERVICE_ACCOUNT_PRIVATE_KEY = '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n';
const ORGANIZATION_ADMIN_EMAIL = '[email protected]';

googleCalendar.scheduleCalendarMeetings(meetings, SERVICE_ACCOUNT_CLIENT_EMAIL, SERVICE_ACCOUNT_PRIVATE_KEY, ORGANIZATION_ADMIN_EMAIL)
    .then((result) => {
        console.log(result);
    })
    .catch((error) => {
        console.error(error);
    });

createCalendarMeetingEvent

The createCalendarMeeting function is responsible for creating a new meeting on the Google Calendar of the organizer. The function takes the following parameters

Params

  • meetingStartTime {Date}: The start time of the meeting in ISO format.
  • meetingEndTime {String}: The end time of the meeting in ISO format.
  • scheduledMeeting {Object}: An object containing details of the meeting, including its title, description, organizerEmail, and attendeesEmail.
  • organizerEmail {String}: The email address of the meeting organizer.
  • googleCalendarAuth {String}: An authenticated Google Calendar API client.
  • returns {Array}: scheduled google meeting data.

Example

const { createCalendarMeeting } = require('google-calendar-free-slots-scheduler');

const meetingStartTime = '2023-05-01T10:00:00-07:00';
const meetingEndTime = '2023-05-01T11:00:00-07:00';
const scheduledMeeting = {
  title: 'New Meeting',
  description: 'This is a new meeting',
  organizerEmail: '[email protected]',
  attendeesEmail: ['[email protected]', '[email protected]'],
};
const organizerEmail = '[email protected]';
const googleCalendarAuth = new google.auth.JWT(
        SERVICE_ACCOUNT_CLIENT_EMAIL,
        null,
        SERVICE_ACCOUNT_PRIVATE_KEY,
        GOOGLE_CALENDAR_SCOPE,
        ORGANIZATION_ADMIN_EMAIL
);        
        createCalendarMeeting(meetingStartTime, meetingEndTime, scheduledMeeting, organizerEmail, googleCalendarAuth)
                .then((result) => {
                  console.log(result);
                })
                .catch((error) => {
                  console.error(error);
                });

getUsersFreeSlots

The getUsersFreeSlots function is responsible for fetching the free time slots for a given list of participants within a specified date range. The function takes the following parameters:

Params

  • participantsEmail {Date}: An array of email addresses of the participants for whom the free slots are to be fetched.
  • withinStartDate {String}: The start date in ISO format of the date range for which the free slots are to be fetched.
  • withinEndDate {Object}: The end date in ISO format of the date range for which the free slots are to be fetched.
  • userStartDate {String}: The start date in ISO format from which to start fetching the free slots.
  • googleCalendarAuth {String}: An authenticated Google Calendar API client.
  • returns {Array}: list of provided users free slots.

Example

const { getUsersFreeSlots } = require('google-calendar-free-slots-scheduler');

const participantsEmail = ['[email protected]', '[email protected]'];
const withinStartDate = '2023-05-01';
const withinEndDate = '2023-05-07';
const userStartDate = '2023-05-01';
const googleCalendarAuth = new google.auth.JWT(
        SERVICE_ACCOUNT_CLIENT_EMAIL,
        null,
        SERVICE_ACCOUNT_PRIVATE_KEY,
        GOOGLE_CALENDAR_SCOPE,
        ORGANIZATION_ADMIN_EMAIL
);
getUsersFreeSlots(participantsEmail, withinStartDate, withinEndDate, userStartDate, googleCalendarAuth)
                .then((result) => {
                  console.log(result);
                })
                .catch((error) => {
                  console.error(error);
                });

Author

Muhammad Uzair

License

This package is licensed under the MIT License.