Created
September 1, 2015 17:48
-
-
Save khamidou/085d1f53a49ac2be95c0 to your computer and use it in GitHub Desktop.
Nylas nodejs API example --- Creating an event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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