{"id":13447503,"url":"https://github.com/yuhong90/node-google-calendar","last_synced_at":"2026-03-06T12:32:44.509Z","repository":{"id":57140944,"uuid":"58501267","full_name":"yuhong90/node-google-calendar","owner":"yuhong90","description":"Simple node module that supports Google Calendar API","archived":false,"fork":false,"pushed_at":"2020-05-04T00:32:57.000Z","size":97,"stargazers_count":85,"open_issues_count":18,"forks_count":32,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-09-15T03:37:40.304Z","etag":null,"topics":["calendar","events","google-api","google-calendar","promises","service-account"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuhong90.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-11T00:08:23.000Z","updated_at":"2025-07-24T08:30:00.000Z","dependencies_parsed_at":"2022-09-01T23:51:51.036Z","dependency_job_id":null,"html_url":"https://github.com/yuhong90/node-google-calendar","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/yuhong90/node-google-calendar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhong90%2Fnode-google-calendar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhong90%2Fnode-google-calendar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhong90%2Fnode-google-calendar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhong90%2Fnode-google-calendar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuhong90","download_url":"https://codeload.github.com/yuhong90/node-google-calendar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhong90%2Fnode-google-calendar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30176248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T11:48:51.886Z","status":"ssl_error","status_checked_at":"2026-03-06T11:48:51.460Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","events","google-api","google-calendar","promises","service-account"],"created_at":"2024-07-31T05:01:19.510Z","updated_at":"2026-03-06T12:32:44.481Z","avatar_url":"https://github.com/yuhong90.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# node-google-calendar\n[![Build Status](https://travis-ci.org/yuhong90/node-google-calendar.svg?branch=master)](https://travis-ci.org/yuhong90/node-google-calendar)\n[![Known Vulnerabilities](https://snyk.io/test/github/yuhong90/node-google-calendar/badge.svg)](https://snyk.io/test/github/yuhong90/node-google-calendar)\n\n\nSimple node module that supports Google Calendar API\n\nThis module does server to server authentication with Google APIs without any users being involved.\nWhen using Google APIs from the server (or any non-browser based application), authentication is performed through a Service Account, which is a special account representing your application.    \n\nFind out more about [preparations needed](https://github.com/yuhong90/node-google-calendar/wiki#preparations-needed) to setting up the [service account](https://github.com/yuhong90/node-google-calendar/wiki#setup-service-accounts), grant calendar access, [auth key to google](https://github.com/yuhong90/node-google-calendar/wiki#providing-key-or-keyfile-for-google-oauth) and the configurations needed to start using node-google-calendar.\n\n\n\n## Getting Started\n\nFirst, install the [npm package](https://www.npmjs.com/package/node-google-calendar) with: `npm i node-google-calendar --save`.\n\nProvide in a `settings.js` config file with serviceAcctId, calendarIds, timezone \u0026 keyfile location.   \nCheck out [preparations needed](https://github.com/yuhong90/node-google-calendar/wiki#preparations-needed) if you have trouble supplying these configurations. Sample config file [here](https://github.com/yuhong90/node-google-calendar/blob/master/config/Settings.js).   \n\nYour config file should look something like this:\n```javascript\nconst KEYFILE = '\u003cyourpem.pem\u003e';\nconst SERVICE_ACCT_ID = '\u003cservice_account\u003e@\u003cproject_name\u003e.iam.gserviceaccount.com';\nconst CALENDAR_ID = {\n  'primary': '\u003cmain-calendar-id\u003e@gmail.com',\n  'calendar-1': 'calendar1@group.calendar.google.com',\n  'calendar-2': 'calendar2@group.calendar.google.com'\n};\nconst TIMEZONE = 'UTC+08:00';\n\nmodule.exports.keyFile = KEYFILE;           //or if using json keys - module.exports.key = key;\nmodule.exports.serviceAcctId = SERVICE_ACCT_ID;\nmodule.exports.calendarId = CALENDAR_ID;\nmodule.exports.timezone = TIMEZONE;\n```\n\nTo use, require this module in your application and pass in the necessary config file.\n```javascript\n  const CONFIG = require('./config/Settings');\n  const CalendarAPI = require('node-google-calendar');\n  let cal = new CalendarAPI(CONFIG);  \n```\nYou should now be able to query your specified calendar and try out the following examples.\n\n\n## APIs\nMost [Google Calendar APIs v3](https://developers.google.com/google-apps/calendar/concepts/) are now supported! This includes APIs in resource types of [Calendars](https://developers.google.com/google-apps/calendar/v3/reference/calendars),\n[CalendarList](https://developers.google.com/google-apps/calendar/v3/reference/calendarList),\n[Acl](https://developers.google.com/google-apps/calendar/v3/reference/acl),\n[Events](https://developers.google.com/google-apps/calendar/v3/reference/events),\n[FreeBusy](https://developers.google.com/google-apps/calendar/v3/reference/freebusy),\n[Settings](https://developers.google.com/google-apps/calendar/v3/reference/settings),\n[Colors](https://developers.google.com/google-apps/calendar/v3/reference/colors) \u0026\n[Channels](https://developers.google.com/google-apps/calendar/v3/reference/channels).\nYou can refer to Google's documentation on what parameters to supply, and choose to include or exclude the parameters that you need.\n\nSome examples are as follows:\n### [CalendarList](https://github.com/yuhong90/node-google-calendar/blob/master/src/CalendarList.js) Examples\nCalendarList.list - Returns a promise of a CalendarList of calendar entries and their metadata that the service account has visibility to.\n```javascript\nlet params = {\n  showHidden: true\n};\n\ncal.CalendarList.list(params)\n  .then(resp =\u003e {\n\tconsole.log(resp);\n  }).catch(err =\u003e {\n\tconsole.log(err.message);\n  });\n```\n\n### [Acl](https://github.com/yuhong90/node-google-calendar/blob/master/src/Acl.js) Examples\nAcl.insert - Granting a user `owner` permission of to a calendar. Calendar entry should be automatically added to user's CalendarList after success. (Appear on calendarlist on left side of Google Calendar's WebUI)  \n```javascript\nlet params = {\n\tscope: {\n\t\ttype: 'user',\n\t\tvalue: 'your-user@gmail.com'\n\t},\n\trole: 'owner'\n};\n\ncal.Acl.insert(calendarId, params)\n  .then(resp =\u003e {\n\tconsole.log(resp);\n  }).catch(err =\u003e {\n\tconsole.log(err.message);\n  });\n```\n\n### [Events](https://github.com/yuhong90/node-google-calendar/blob/master/src/Events.js) Examples\nEvents.list - To get a promise of all single events in calendar within a time period.\n```javascript\nlet params = {\n\ttimeMin: '2017-05-20T06:00:00+08:00',\n\ttimeMax: '2017-05-25T22:00:00+08:00',\n\tq: 'query term',\n\tsingleEvents: true,\n\torderBy: 'startTime'\n}; \t//Optional query parameters referencing google APIs\n\ncal.Events.list(calendarId, params)\n  .then(json =\u003e {\n\t//Success\n\tconsole.log('List of events on calendar within time-range:');\n\tconsole.log(json);\n  }).catch(err =\u003e {\n\t//Error\n\tconsole.log('Error: listSingleEvents -' + err.message);\n  });\n```\n\nEvents.insert - Insert an event on a specified calendar. Returns promise of details of new event.\n```javascript\nlet params = {\n\t'start': { 'dateTime': '2017-05-20T07:00:00+08:00' },\n\t'end': { 'dateTime': '2017-05-20T08:00:00+08:00' },\n\t'location': 'Coffeeshop',\n\t'summary': 'Breakfast',\n\t'status': 'confirmed',\n\t'description': '',\n\t'colorId': 1\n};\n\ncal.Events.insert(calendarId, params)\n  .then(resp =\u003e {\n\tconsole.log('inserted event:');\n\tconsole.log(resp);\n  })\n  .catch(err =\u003e {\n\tconsole.log('Error: insertEvent-' + err.message);\n  });\n```\n\nEvents.delete - Deletes an Event on a specified Calendar with EventId. Returns promise of results.\n```javascript\nlet params = {\n\tsendNotifications: true\n};\n\ncal.Events.delete(calendarId, eventId, params)\n  .then(results =\u003e {\n\tconsole.log('delete Event:' + JSON.stringify(results));\n  }).catch(err =\u003e {\n        console.log('Error deleteEvent:' + JSON.stringify(err.message));\n  });\n```\n\nEvents.patch - Specify part of an **existing** event to modify. Returns promise of results.\nMust specify the eventId (the \"id\" of an event) and any fields you'd like to modify. All other fields remain untouched.\n\n```javascript\ncal.Events.patch(calendarId, eventId, {\n       summary: \"updated summary\",\n       ...\n       ...\n     })\n     .then(results =\u003e {\n       console.log(\"patched Event:\" + JSON.stringify(results));\n     })\n     .catch(err =\u003e {\n       console.log(\"Error patchedEvent:\" + JSON.stringify(err.message));\n     });\n   })\n```\n\n### [FreeBusy](https://github.com/yuhong90/node-google-calendar/blob/master/src/FreeBusy.js) Examples\nFreeBusy.query - Checks if queried calendar slot is busy during selected period. Returns promise of list of events at specified slot.\n```javascript\nlet params = {\n\t\"timeMin\": '2017-05-20T08:00:00+08:00',\n\t\"timeMax\": '2017-05-20T09:00:00+08:00',\n\t\"items\": [{ \"id\": calendarId }]\n};\n\ncal.FreeBusy.query(calendarId, params)\n  .then(resp =\u003e {\n  \tconsole.log('List of busy timings with events within defined time range: ');\n        console.log(resp);\n  })\n  .catch(err =\u003e {\n\tconsole.log('Error: checkBusy -' + err.message);\n  });\n```\n\n### [Settings](https://github.com/yuhong90/node-google-calendar/blob/master/src/Settings.js) Examples\nSettings.list - List user settings  \n```javascript\nlet params = {};\ncal.Settings.list(params)\n  .then(resp =\u003e {\n\tconsole.log('List settings: ');\n\tconsole.log(resp);\n  })\n  .catch(err =\u003e {\n\tconsole.log('Error: listSettings -' + err.message);\n  });\n```\n\n\nMore code examples of the various APIs [here](https://github.com/yuhong90/node-google-calendar/tree/master/example).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhong90%2Fnode-google-calendar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuhong90%2Fnode-google-calendar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhong90%2Fnode-google-calendar/lists"}