Skip to content

Instantly share code, notes, and snippets.

@khamidou
Created September 1, 2015 17:48
Show Gist options
  • Save khamidou/085d1f53a49ac2be95c0 to your computer and use it in GitHub Desktop.
Save khamidou/085d1f53a49ac2be95c0 to your computer and use it in GitHub Desktop.
Nylas nodejs API example --- Creating an event
// Every event belongs to a calendar, so grab the first writable calendar
nylas.calendars.list({}).then(function(calendars) {
cal = null;
for(var i = 0; i < calendars.length; i++) {
if (calendars[i].readOnly != true) {
cal = calendars[i];
break;
}
}
ev = nylas.events.build({title: 'Friday meeting', calendarId: cal.id})
// Change attributes as necessary
ev.location = 'Nylas HQ'
// Dates are expressed by the Inbox API as UTC timestamps
ev.start = 1407542195
ev.end = 1407543195
// Persist the event --- it's automatically synced back to the Google or Exchange calendar
ev.save();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment