Google Apps脚本网络应用的Drive API推送通知 [英] Drive API Push Notifications for a Google Apps Script Web App

查看:108
本文介绍了Google Apps脚本网络应用的Drive API推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Google Drive API设置推送通知,并使用Google Apps脚本设置网络挂钩.我不知道这是否可行.

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);
}

当我尝试验证URL时,它为我提供了https://script.google.com/...ZS2/exec作为端点.但是,当我尝试验证它是否按https://script.google.com/...ZS2/exec/并找到完全不同的meta标记时.

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.

有没有人成功将驱动器api和推送通知与google apps脚本一起使用?我想念什么?

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

推荐答案

不幸的是,不再可能验证GAS Web App网址.直到2019年8月前后,在应用脚本"编辑器的"发布"菜单下可以选择"在Chrome网上应用店注册".那时,任何这样注册的Web应用程序都会自动验证其URL.但是,此选项已被删除,并且搜索控制台下可用的验证方法根本不适用于GAS Web App网址.

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.

此外,即使验证可行,也无法有效利用云端硬盘推送通知,因为所有相关的通知信息都存储在HTTP标头中,而该标头无法通过GAS doPost()函数进行访问.

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脚本不再是用于实施Google API推送通知(Gmail,云端硬盘,日历,管理目录等)的可行平台.如果您想坚持使用Google的云产品,可以尝试其他方法. Google Cloud Functions就是这样一种选择.

Google Apps Script is no longer a viable platform for implementing Google API Push Notifications (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.

这篇关于Google Apps脚本网络应用的Drive API推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆