How can I use the Drive's Push Notifications API in conjunction with the GAS Published app?
I've setup the folowing App below that appends anything that receives via GET/POST into this sheet for testing, and a failed attempt of adding the WATCH into the published URL, I get the error "Insufficient Permission".
Can I use the App even if I can't use the authorization options present in the documentation?
var sslog = SpreadsheetApp.openById('1RIxhdCQlZ52-GJG43m4fdMiCLSCtXjK62YxY4M2aXkc').getSheets()[0];
function doPost(e) {
sslog.appendRow([e]);
return 200;
}
function doGet(e) {
sslog.appendRow([e]);
return 200;
}
function addWatch(){
var PayLoad = {
"id": "4baa4sd80-6ass-1asd4e2-bs5fd-0asd848c9a77", // Your channel ID.
"type": "web_hook",
"address": "https://script.google.com/macros/s/AKfycbwBoiIBIJaAJVWJb5Tboc_Wz0RNDxaD_8raKnnLWO_WllO3Lnfe/exec", // Your receiving URL.
"expiration": ((new Date()).getTime() + 1000*60*5)// (Optional) Your requested channel expiration time.
}
var headers = { 'Authorization': 'Bearer ' + ScriptApp.getOAuthToken(), 'Content-Type': 'application/json' };
var url = 'https://www.googleapis.com/drive/v2/files/15flCrMJ4ItmPZzVzdfmOFuz44iG7xSIqSV066BW7G-Q/watch';
var mod = UrlFetchApp.fetch(url, { headers:headers, payload:JSON.stringify(PayLoad), method:'POST' });
}
I've tried to use the Drive.Changes.watch(resource, optionalArgs)
from here, but dunno what to use as resource/args.