Giter Site home page Giter Site logo

node-google-calendar's Introduction

node-google-calendar

Build Status Known Vulnerabilities

Simple node module that supports Google Calendar API

This module does server to server authentication with Google APIs without any users being involved. When 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.

Find out more about preparations needed to setting up the service account, grant calendar access, auth key to google and the configurations needed to start using node-google-calendar.

Getting Started

First, install the npm package with: npm i node-google-calendar --save.

Provide in a settings.js config file with serviceAcctId, calendarIds, timezone & keyfile location.
Check out preparations needed if you have trouble supplying these configurations. Sample config file here.

Your config file should look something like this:

const KEYFILE = '<yourpem.pem>';
const SERVICE_ACCT_ID = '<service_account>@<project_name>.iam.gserviceaccount.com';
const CALENDAR_ID = {
  'primary': '<main-calendar-id>@gmail.com',
  'calendar-1': '[email protected]',
  'calendar-2': '[email protected]'
};
const TIMEZONE = 'UTC+08:00';

module.exports.keyFile = KEYFILE;           //or if using json keys - module.exports.key = key;
module.exports.serviceAcctId = SERVICE_ACCT_ID;
module.exports.calendarId = CALENDAR_ID;
module.exports.timezone = TIMEZONE;

To use, require this module in your application and pass in the necessary config file.

  const CONFIG = require('./config/Settings');
  const CalendarAPI = require('node-google-calendar');
  let cal = new CalendarAPI(CONFIG);  

You should now be able to query your specified calendar and try out the following examples.

APIs

Most Google Calendar APIs v3 are now supported! This includes APIs in resource types of Calendars, CalendarList, Acl, Events, FreeBusy, Settings, Colors & Channels. You can refer to Google's documentation on what parameters to supply, and choose to include or exclude the parameters that you need.

Some examples are as follows:

CalendarList Examples

CalendarList.list - Returns a promise of a CalendarList of calendar entries and their metadata that the service account has visibility to.

let params = {
  showHidden: true
};

cal.CalendarList.list(params)
  .then(resp => {
	console.log(resp);
  }).catch(err => {
	console.log(err.message);
  });

Acl Examples

Acl.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)

let params = {
	scope: {
		type: 'user',
		value: '[email protected]'
	},
	role: 'owner'
};

cal.Acl.insert(calendarId, params)
  .then(resp => {
	console.log(resp);
  }).catch(err => {
	console.log(err.message);
  });

Events Examples

Events.list - To get a promise of all single events in calendar within a time period.

let params = {
	timeMin: '2017-05-20T06:00:00+08:00',
	timeMax: '2017-05-25T22:00:00+08:00',
	q: 'query term',
	singleEvents: true,
	orderBy: 'startTime'
}; 	//Optional query parameters referencing google APIs

cal.Events.list(calendarId, params)
  .then(json => {
	//Success
	console.log('List of events on calendar within time-range:');
	console.log(json);
  }).catch(err => {
	//Error
	console.log('Error: listSingleEvents -' + err.message);
  });

Events.insert - Insert an event on a specified calendar. Returns promise of details of new event.

let params = {
	'start': { 'dateTime': '2017-05-20T07:00:00+08:00' },
	'end': { 'dateTime': '2017-05-20T08:00:00+08:00' },
	'location': 'Coffeeshop',
	'summary': 'Breakfast',
	'status': 'confirmed',
	'description': '',
	'colorId': 1
};

cal.Events.insert(calendarId, params)
  .then(resp => {
	console.log('inserted event:');
	console.log(resp);
  })
  .catch(err => {
	console.log('Error: insertEvent-' + err.message);
  });

Events.delete - Deletes an Event on a specified Calendar with EventId. Returns promise of results.

let params = {
	sendNotifications: true
};

cal.Events.delete(calendarId, eventId, params)
  .then(results => {
	console.log('delete Event:' + JSON.stringify(results));
  }).catch(err => {
        console.log('Error deleteEvent:' + JSON.stringify(err.message));
  });

Events.patch - Specify part of an existing event to modify. Returns promise of results. Must specify the eventId (the "id" of an event) and any fields you'd like to modify. All other fields remain untouched.

cal.Events.patch(calendarId, eventId, {
       summary: "updated summary",
       ...
       ...
     })
     .then(results => {
       console.log("patched Event:" + JSON.stringify(results));
     })
     .catch(err => {
       console.log("Error patchedEvent:" + JSON.stringify(err.message));
     });
   })

FreeBusy Examples

FreeBusy.query - Checks if queried calendar slot is busy during selected period. Returns promise of list of events at specified slot.

let params = {
	"timeMin": '2017-05-20T08:00:00+08:00',
	"timeMax": '2017-05-20T09:00:00+08:00',
	"items": [{ "id": calendarId }]
};

cal.FreeBusy.query(calendarId, params)
  .then(resp => {
  	console.log('List of busy timings with events within defined time range: ');
        console.log(resp);
  })
  .catch(err => {
	console.log('Error: checkBusy -' + err.message);
  });

Settings Examples

Settings.list - List user settings

let params = {};
cal.Settings.list(params)
  .then(resp => {
	console.log('List settings: ');
	console.log(resp);
  })
  .catch(err => {
	console.log('Error: listSettings -' + err.message);
  });

More code examples of the various APIs here.

node-google-calendar's People

Contributors

fweffort avatar joshspicer avatar kylebebak avatar mycaule avatar petergzli avatar seanecoffey avatar shekyh avatar yuhong90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-google-calendar's Issues

Recurrence changes GCal's displayed start time

Issue: Sending an event WITHOUT a recurrence shows up exactly as it should in the interface. But when I specify a recurrence, the "Start Time" seems to jump backward two hours in the display in Google Calendar.

Here is some sample data. On mine, the event that reoccurs shows up starting at at 5pm instead of 7pm, even though the start datetime is clearly 19:00:00-07:00 in both events.

[ { summary: 'Fully Booked',
    start:
     { dateTime: '2019-04-04T19:00:00-07:00',
       timeZone: 'America/Los_Angeles' },
    end:
     { dateTime: '2019-04-06T13:00:00-07:00',
       timeZone: 'America/Los_Angeles' } },
  { summary: 'Fully Booked',
    start:
     { dateTime: '2019-04-06T19:00:00-07:00',
       timeZone: 'America/Los_Angeles' },
    end:
     { dateTime: '2019-04-07T09:00:00-07:00',
       timeZone: 'America/Los_Angeles' },
    recurrence:
     [ 'RDATE;VALUE=DATE:20190408,20190409,20190410,20190411,20190412,20190413,20190414,20190415,20190416,20190417,201904
18,20190419,20190420,20190421,20190422,20190423,20190424,20190425,20190426,20190427,20190428,20190429,20190430,20190501,2
0190502,20190503,20190504,20190505,20190506,20190507,20190508,20190509,20190510,20190511,20190512,20190513,20190514,20190
515,20190516,20190517,20190518,20190519,20190520,20190521,20190522,20190523,20190524,20190525,20190526,20190527,20190528,
20190529,20190530,20190531,20190601,20190602,20190603,20190604,20190605,20190606,20190607,20190608,20190609,20190610,2019
0611,20190612,20190613,20190614,20190615,20190616,20190617,20190618,20190619,20190620,20190621,20190622,20190623,' ] },
 ]

Can anyone else reproduce this?

No idea why im getting this error :(

Error: listSingleEvents -{"origin":"Events.list","error":{"statusCode":"400(Bad Request)","errorBody":"<HTML>\n<HEAD>\n<TITLE>Bad Request</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n<H1>Bad Request</H1>\n<H2>Error 400</H2>\n</BODY>\n</HTML>\n"}}

`const CONFIG = require('./settings.js');
const CalendarAPI = require('node-google-calendar');
let cal = new CalendarAPI(CONFIG);

let params = {
singleEvents: true,
orderBy: 'startTime'
}; //Optional query parameters referencing google APIs

cal.Events.list(CONFIG.calendarId, params)
.then(json => {
//Success
console.log('List of events on calendar within time-range:');
console.log(json);
}).catch(err => {
//Error
console.log('Error: listSingleEvents -' + err.message);
});`

404 when trying to insert a new event

The following insertion:

cal.Events.insert(config.calendarId.games, {
  start: {'dateTime': '2017-10-20T07:00:00+03:00'},
  end: {'dateTime': '2017-10-20T08:00:00+03:00'},
  location: 'Coffeeshop',
  summary: 'Breakfast',
  status: 'confirmed',
  description: '',
  colorId: 1
})

Rejects with the following error:

{  
   "origin":"Events.insert",
   "error":{  
      "statusCode":"404(Not Found)",
      "errorBody":{  
         "error":{  
            "errors":[  
               {  
                  "domain":"global",
                  "reason":"notFound",
                  "message":"Not Found"
               }
            ],
            "code":404,
            "message":"Not Found"
         }
      }
   }
}

I am not sure why 404, and couldn't find any reference in the docs to this kind of error.

Full code:

const config = {
  serviceAcctId: 'MY ACCOUNT ID@MY APP.iam.gserviceaccount.com',
  calendarId: {
    "games": "COPIERD FROM GOOGLE [email protected]",
    "work": "COPIERD FROM GOOGLE [email protected]"
  },
  key: "-----BEGIN PRIVATE KEY-----MY KEY HERE----END PRIVATE KEY-----\n",
  timezone: 'UTC+03:00'
};

const CalendarAPI = require('node-google-calendar');

const cal = new CalendarAPI(config);

cal.Events.insert(config.calendarId.games, {
  start: {'dateTime': '2017-10-20T07:00:00+03:00'},
  end: {'dateTime': '2017-10-20T08:00:00+03:00'},
  location: 'Coffeeshop',
  summary: 'Breakfast',
  status: 'confirmed',
  description: '',
  colorId: 1
})
  .then(resp => {
    console.log('inserted event:');
    console.log(resp);
  })
  .catch(err => {
    console.log('Error: insertEvent-' + err.message);
  });

Events.list() does not allow pagination

If I run Events.list() on a large calendar it does not handle nextPageToken in the result but neither does it pass it through. This makes it impossible to get a list of events greater than the maximum allowed per page of 2,500.

Either Events.list() should handle the pagination or maybe it should return body rather than body.items (although this would not be backwards compatible).

colorid not changing the event color

I have this code with the colorId set, but it seems not have any effect. Everything else is working, but the color is not set. Also when updating the event it always sets the color to the default and overwrites if the event color was changed by a user in google calendar. Am i missing something for the colorId parameter? I've tried to leave it completely out to not overwite user's color changes, but even then it resets the color to the default, overriding the user's changes.

let event = {
    'start': { 'dateTime': start_date },
    'end': { 'dateTime': end_date },
    'location': location,
    'summary': summary,
    //'status': 'confirmed',
    'description': description,
    'colorId': 5 
}
resp = await cal.Events.insert(calendarId, event)

batch requests

This is probably a feature request or is it already possible to do batch requests with this module?
https://developers.google.com/calendar/batch

These are multipart requests that contain multiple requests in one main authorized request.

I frequently encounter "Rate Limit Exceeded" errors when doing lots of requests. This is because of too many requests (flood protection by google api) and batch requests could help here.

Simplify API function parameters

Right now using a method requires supplying parameters in order, e.g.

// function declaration
function insertEvent(calendarId, eventSummary, startDateTime, endDateTime, location, status, description, colour) { ... };
// actual usage
insertEvent('primary', null, ................);
// function declaration
function insertEvent(event) {
  // reject if required parameters are not present
  // e.g. if (!event.start) throw new Error('Start time missing');

  // plug event directly into request body
};
// actual usage
let event1 = {
  summary: 'Event 1',
  start: {
    dateTime: '2015-05-28T09:00:00-07:00'
  },
  end: {
    dateTime: '2015-05-28T17:00:00-07:00'
  }
};

let event2 = {
  calendarId: 'primary',
  eventSummary: 'Event 2',
  description: 'I can add descriptions if I want to',
  start: {
    dateTime: '2015-05-28T09:00:00-07:00'
  },
  end: {
    dateTime: '2015-05-28T17:00:00-07:00'
  }
};

insertEvent(event1);
insertEvent(event2);

Users can refer to Google's documentation on what parameters to supply, and choose to include or exclude parameters.

Issue with specific date range?

Whenever I try to specify a specific date range it always returns null, although it works whenever this isnt set, my params look like this
let params = { timeMin: '2018-12-01T01:00:00+01:00', timeMax: '2018-12-05T23:59:00+01:00', q: 'query term', singleEvents: true, orderBy: 'startTime' };
anyone else having this issue?

not working with android

with web app all good
but same with android not working
i get

Error: invalid_request Required parameter is missing: response_type

In the config file you set CalendarID's but it's never used

It is not using the CalendarID constant created in settings.js and is therefor useless, I had to add this._calendarId = config.calendarId to the constructor of CalendarAPI and get CalendarId() { return this._calendarId; } to use the declared calendars. For example: cal.CalendarId.primary

Unable to resolve module `fs` from

When I am include the following line in my project:

const CalendarAPI = require('node-google-calendar');

I am getting an error:

UnableToResolveError: Unable to resolve module fs from /{path to project}/node_modules/google-oauth-jwt/lib/auth.js: Module does not exist in the module map

When I comment the line out, error is gone.

What is going wrong?

Cannot update an all day event, error missing endTime

Ideally I wanted to use event.patch for this as I only want to update the event title, but I see its not included in this library, so i'm trying to use insert by first getting the full event resource, updating the field I am interested in and then calling event.insert

My event resource does not contain start and end "dateTimes", just dates, as it is an all-day event.

My event resource looks like this

{ kind: 'calendar#event', etag: '"####"', id: '###', status: 'confirmed', htmlLink: '###', created: '2018-10-04T14:29:21.000Z', updated: '2018-10-04T14:29:21.362Z', summary: 'ALL DAY EVENT?', description: 'taskId ###', colorId: '11', creator: { email: '###' }, organizer: { email: '###', displayName: '###', self: true }, start: { date: '2018-10-04' }, end: { date: '2018-10-05' }, transparency: 'transparent', iCalUID: '###', sequence: 0, reminders: { useDefault: true } }

This is the error that I am seeing
'Error: insertEvent-{"origin":"Events.insert","error":{"statusCode":"400(Bad Request)","errorBody":{"error":{"errors":[{"domain":"global","reason":"required","message":"Missing end time."}],"code":400,"message":"Missing end time."}}

This could be an issue with google API itself, weird that it allows you to create an event without a startTime but then requires it for an update.
https://stackoverflow.com/questions/31555019/google-calendar-api-update-missing-end-time

Would it require a lot to add a patch function?

Love your library by the way, I was prettty much implementing my own one when I came across this! Kudos!

Tiny issue with documentation

Hi,

Tiny issue with documentation. In your sample config, module.exports.keyfile should be module.exports.keyFile

Thanks! :)

No results, what am I doing wrong?

Hi I have some problem with setting up and receiving events from my calendar. I made a service account and got the JSON for the private key. Next I added the service account email to my calendar AND made the calendar publicly accessible. I enabled the Calendar API and I can see it getting called with every request. Someone please help, this what I get with every request I make:
{ kind: 'calendar#calendarList', etag: '"p3000"', nextSyncToken: 'CAASKWNhbGVuZGFyQGFjdGl2aS0xLmlhbS5nc2Vydmlj**************', items: [] }

settings.js
`const KEY = require('./company-1-268dbde62afc.json').private_key
const SERVICE_ACCT_ID = '[email protected]'
const CALENDAR_ID = {
primary: '[email protected]'
}
const TIMEZONE = 'UTC+01:00'

module.exports.key = KEY
module.exports.serviceAcctId = SERVICE_ACCT_ID
module.exports.calendarId = CALENDAR_ID
module.exports.timezone = TIMEZONE`

calendar.js
`const CalendarAPI = require('node-google-calendar')
const CONFIG = require('./calendar/settings')
const cal = new CalendarAPI(CONFIG)

const params = {
showHidden: true,
maxResults: 1000,
singleEvents: true
}

// Test!
function calendar () {
cal.CalendarList.list(params)
.then(res => {
console.log(res)
}).catch(err => {
console.log(err.message)
})
}

module.exports = {
calendar
}`

Error when listing events

Hello,

I'm trying to list events in a calendar, configuration seems ok, as I'm able to get calendar list with the following response:

{ kind: 'calendar#calendarList', etag: '"*******"', nextSyncToken: '*********', items: [ { kind: 'calendar#calendarListEntry', etag: '"********"', id: '*****@gmail.com', summary: '*****@gmail.com', timeZone: 'America/Guatemala', colorId: '20', backgroundColor: '#cabdbf', foregroundColor: '#000000', selected: true, accessRole: 'owner', defaultReminders: [], conferenceProperties: [Object] } ] }

But when trying to list events of a calendar (I'm using the code from the list all events example), I got the following error:

Error: listAllEventsInCalendar {"origin":"Events.list","error":{"statusCode":"400(Bad Request)","errorBody":"<HTML>\n<HEAD>\n<TITLE>Bad Request</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n<H1>Bad Request</H1>\n<H2>Error 400</H2>\n</BODY>\n</HTML>\n"}}

JSON key support?

Just created a service account, and noticed it gives the option for a .json key, is/will this be supported?

example file:

{
  "type": "service_account",
  "project_id": "blahblah",
  "private_key_id": "123...",
  "private_key": "-----BEGIN PRIVATE KEY-----\n_LOTS_OF_STUFF_IN_HERE_==\n-----END PRIVATE KEY-----\n",
  "client_email": "[email protected]",
  "client_id": "123...",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/blahblahblah.iam.gserviceaccount.com"
}

New event not getting created when adding attendee

When i try to create an event with an attendee it gives a 403 error, but works fine when creating without an attendee. Has anyone faced this using node-google-calendar? i am following the steps mentioned to configure service account etc.

{"statusCode":"403(Forbidden)","errorBody":{"error":{"errors":[{"domain":"usageLimits","reason":"quotaExceeded","message":"Calendar usage limits exceeded."}],"code":403,"message":"Calendar usage limits exceeded."}}}}

I am using my free google calendar, not a gsuite account.

When googled i saw this issue being reported here - https://issuetracker.google.com/issues/141704931

Has anyone in this community overcome this as i did not see anyone reporting this here

Cant view events on google calendar

I'm unable to insert a google calendar event as it returns me a 404 error. Here is my code:

 insertEvent(calendarIdList['calendar-1'], 'TestEventName', '2017-05-20T12:00:00+08:00', '2017-05-20T15:00:00+08:00', 'location', 'confirmed', 'some description here');

function insertEvent(calendarId, eventSummary, startDateTime, endDateTime, location, status, description) {
	let event = {
		'start': {
			'dateTime': startDateTime
		},
		'end': {
			'dateTime': endDateTime
		},
		'location': location,
		'summary': eventSummary,
		'status': status,
		'description': description,
		'colorId': 1
	};

	cal.Events.insert(calendarId, event)
		.then(resp => {
			let json = resp;
			let results = {
				id: json.id,
				'summary': json.summary,
				'location': json.location,
				'status': json.status,
				'htmlLink': CALENDAR_URL,
				'start': json.start.dateTime,
				'end': json.end.dateTime,
				'created': new Date(json.created)
			};
			console.log('inserted event:');
			console.log(results);
		})
		.catch(err => {
			console.log('Error: insertEvent-' + err);
		});
}

This is the settings file for calendar_id

const CALENDAR_ID = {
	'primary': '',
	'calendar-1': '[email protected]'
};

Then when I go to my calendar and make it public, it returns me a 403 error response "forbidden"

EDIT: It was because I didnt share the calendar with my googles service account.

I am now able to get this working, phew...

Invalid_client error Error 401 on listEvents

This may be because I have confused the terminology. Here's my json file:
{
"type": "service_account",
"project_id": "slackchatbot-158302",
"private_key_id": "aaa1111111111aaa1111111',
"private_key": "-----BEGIN PRIVATE KEY-----\nMII0Khvqr0NetaXZBz6vPV\nzOmdPlvd4cFRuQiWTIvLyGfgbQ==\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "115464219574XXXXXXXXX",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/calendaraccess%40someacct.iam.gserviceaccount.com"
}
my settings.js file looks like this:
var fs = require('fs');
const KEYPATH='./SlackChatBot-aaa1111111.json';
var json = fs.readFileSync(KEYPATH, 'utf8');
var key = JSON.parse(json).private_key;
var SERVICE_ACCT_ID = 'aaa11111111ee10158c95f8d7577777xxx77x7x7x77x7x';
const CALENDAR_URL = '[email protected]';
var CALENDAR_ID = {
'primary': '[email protected]',
};
module.exports.calendarId = CALENDAR_ID;
module.exports.serviceAcctId = SERVICE_ACCT_ID;
//module.exports.keyfile = KEYFILE; //or if using json keys - module.exports.key = key;
module.exports.calendarUrl = CALENDAR_URL;
module.exports.key = key;

The SERVICE_ACCT_ID I retrieved from the credentials page under Service Account Credential the column ID, the CALENDAR_URL i got from the settings of the calendar itself under "Calendar Address" where it said "Calendar ID", this I duplicated in the CALENDAR_ID. But this would mean the SERVICE_ACCT_ID is the private_key_id from the JSON file, which seems redundant, but I'm not sure where there is another SERVICE_ACCT_ID to use.

some suggestions:

Thanks for the awesome library, this helped me a lot! Here are some changes I made:

  1. No permission to push, or I would have created a PR:

CalendarAPI.js:29
scopes: ['https://www.googleapis.com/auth/calendar'],
// delegationEmail:
// https://github.com/extrabacon/google-oauth-jwt
// "if access is being granted on behalf of someone else, specifies who is impersonating the service account"
delegationEmail: config.delegationEmail

  1. A little easier way to to configure:

    this.config = {
    keyFile: ./credentials/${process.env.GOOGLE_CALENDAR_KEY_FILE_PEM},
    serviceAcctId: '[email protected]',
    timezone: 'UTC+08:00',
    delegationEmail: '[email protected]'
    };

const cal = new CalendarAPI(this.config);

  1. To make sure attendees get email notifications:

cal.Events.insert(calendarId, event, {"sendUpdates": "all"})

insertEvent-calendarID is not defined

I keep getting this error when trying to create an event. "insertEvent-calendarID is not defined"
But the event is created properly on my google calendar.

Any Ideas?

Full error:
at Promise.module.exports.Promise._settlePromise (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:569:18)
at Promise.module.exports.Promise._settlePromise0 (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:614:10)
at Promise.module.exports.Promise._settlePromises (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:693:18)
at Promise.module.exports.Promise._fulfill (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:638:18)
at Promise.module.exports.Promise._settlePromise (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:582:21)
at Promise.module.exports.Promise._settlePromise0 (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:614:10)
at Promise.module.exports.Promise._settlePromises (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:693:18)
at Promise.module.exports.Promise._fulfill (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:638:18)
at Promise.module.exports.Promise._resolveCallback (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:432:57)
at Promise.module.exports.Promise._settlePromiseFromHandler (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:524:17)
at Promise.module.exports.Promise._settlePromise (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:569:18)
at Promise.module.exports.Promise._settlePromise0 (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:614:10)
at Promise.module.exports.Promise._settlePromises (/Users/briantrumbly/development/hermes/node_modules/bluebird/js/release/promise.js:693:18)

Error when inserting event with JSON key

Hello,

I get this error from Calendar API when trying to insert with your library with the code sample provided in the README file.

insertEvent-Error: {"origin":"Events.insert","error":"options.email is required"}

What fields do I need to add ?
https://developers.google.com/google-apps/calendar/v3/reference/events/insert

Node version : v6.11.1

The error probably comes from the google-auth-jwt package
https://github.com/extrabacon/google-oauth-jwt/blob/master/lib/auth.js#L81

Maybe you need to add email field in the JWT Authentication part of your package.
I used the json key method

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.