Last active
April 7, 2016 15:11
-
-
Save swbuehler/80a167c06904edb3120c91dcb9287f37 to your computer and use it in GitHub Desktop.
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
function doPost(e) { | |
moment = Moment.load(); | |
var cal = CalendarApp.getCalendarById('<<CALENDAR ID>>@group.calendar.google.com'); | |
var postContent = e.postData.getDataAsString(); | |
var json = JSON.parse(postContent); | |
var startTime = moment(json.StartTime,'MMMM DD, YYYY at hh:mmA').local().toDate(); | |
var endTime = moment(json.EndTime, 'MMMM DD, YYYY at hh:mmA').local().toDate(); | |
var event = json.Event.toString(); | |
var location = json.Location.toString(); | |
var description = json.Description.toString(); | |
cal.createEvent( | |
event, | |
startTime, | |
endTime, | |
{ | |
"description" : description, | |
"location" : location | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment