2

I want to set up a Push Notification using the Google Drive API and a web hook set up with Google Apps Script. I cannot figure out if this is possible or not.

The part of the steps that I can't figure out are the domain verification steps. I have a web app published with a doGet as below:

function doGet() {
  refreshCandidates();

  return HtmlService.createHtmlOutput('<b>google site verification</b>')
  .addMetaTag('google-site-verification', 'Iu3xxxxxx')
  .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

When I try to verify the url it gives me https://script.google.com/...ZS2/exec as an endpoint. But when I try to verify it is hitting https://script.google.com/...ZS2/exec/ and finding a completely different meta tag.

Has anyone successfully used the drive api and push notifications with google apps script? What am I missing?

Jordan Rhea
  • 1,186
  • 15
  • 34

2 Answers2

5

Unfortunately, it is no longer possible to verify a GAS Web App url. Up until around August 2019, there was an option to "Register in Chrome Web Store" available under the "Publish" menu in the App Script editor. Back then any Web App so registered would have its URL automatically verified. However, that option has since been removed, and the verification methods available under the search console simply do not work for GAS Web App urls.

Furthermore, even when verification was feasible, it was not possible to effectively leverage Drive Push notifications since all relevant notification information is stored in HTTP headers which are not accessible from a GAS doPost() function.

Google Apps Script is no longer a viable platform for implementing Google API Push Notifications across most services (Gmail, Drive, Calendar, Admin Directory etc.). If you want to stick with Google's cloud offerings, there are alternatives you can explore. Google Cloud Functions is one such option.


UPDATE: Gmail leverages Cloud Pubsub for push notifications and this service has recently been updated to remove the need for domain verification for push endpoints. So, going forward its now possible to use GAS Web App URLs in this scenario.

TheAddonDepot
  • 8,408
  • 2
  • 20
  • 30
0

Currently, it doesn't seem to be possible to verify webapp published using Google apps script using Google site verification from search console.

Feature request to Google was made. The issue can be tracked here. Consider adding a star(on top left) for Google to prioritize the issue.

TheMaster
  • 45,448
  • 6
  • 62
  • 85