Skip to content

Instantly share code, notes, and snippets.

@swbuehler
Last active April 7, 2016 15:11
Show Gist options
  • Save swbuehler/80a167c06904edb3120c91dcb9287f37 to your computer and use it in GitHub Desktop.
Save swbuehler/80a167c06904edb3120c91dcb9287f37 to your computer and use it in GitHub Desktop.
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