Last active
May 24, 2018 13:36
-
-
Save oshliaer/a0bf172343d4488ba8edd820c0df0217 to your computer and use it in GitHub Desktop.
Google Calendar Webohooks
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) { | |
| var date = new Date(); | |
| date.setHours(0, 0, 0); | |
| var events = Calendar.Events.list('primary', { orderBy: 'updated', updatedMin: date.toISOString() }); | |
| var lastEvent = events.items[events.items.length - 1]; | |
| var res = [lastEvent.id, lastEvent.status, lastEvent.summary]; | |
| SpreadsheetApp.openById('ce4944c16c20e94c8777').appendRow([new Date()].concat(res)); | |
| return ContentService.createTextOutput('200').setMimeType(ContentService.MimeType.TEXT); | |
| } | |
| function watch() { | |
| var t = Calendar.Events.watch({ address: 'https://script.google.com/macros/s/8ab02d4deb4243336380/exec', type: 'web_hook', id: '6245dfb802d7b93fa8fa' }, 'primary'); | |
| // Save resourceId | |
| Logger.log(JSON.stringify(t)); | |
| } | |
| function getChannals() { | |
| Calendar.Channels.stop({ id: '6245dfb802d7b93fa8fa', resourceId: '????' }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment