[英]Best SERVERLESS way to feed data from multiple Chrome extensions to a single Google Spreadsheet
I have a Chrome browser plugin which performs like a social media posts bookmarks collector (a click on a post captures it's author username, text, date, permalink and the plugin user who owns it).我有一个 Chrome 浏览器插件,它的功能类似于社交媒体帖子书签收集器(点击帖子会捕获它的作者用户名、文本、日期、永久链接和拥有它的插件用户)。 I'm looking for the most efficient, safest and SERVERLESS way to have [potentially] thousands of plugin end-users update, for each individual click on a post, a line in a Google spreadsheet.
我正在寻找最有效、最安全和SERVERLESS 的方式来让 [潜在] 成千上万的插件最终用户更新,每次点击一篇文章,Google 电子表格中的一行。
With my limited knowledge I narrowed the options to webhooks:以我有限的知识,我缩小了 webhooks 的选择范围:
What i'm not sure of is 1) whether a simple webhook can be created using Google Apps?我不确定的是 1) 是否可以使用 Google Apps 创建一个简单的 webhook? 2) can this method be secure enough to prevent non-plugin entries to the RSS feed?
2) 这种方法是否足够安全以防止非插件条目进入 RSS 提要? and 3) is there a simpler more efficient way of achieving this end?
3)是否有更简单更有效的方法来实现这一目标?
Your help will be much appreciated :-) Thanks.您的帮助将不胜感激:-) 谢谢。
You can easily create Webhooks in Google Apps Script through the use of Webapps .您可以通过使用Webapps在 Google Apps Script 中轻松创建 Webhook。 As an example:
举个例子:
function doPost(e) {
if (e.postData && e.postData.type == 'application/json') {
var data = JSON.parse(e.postData.contents);
var author = data['author'];
var text = data['text'];
var date = data['date'];
var permalink = data['permalink'];
var user = data['user'];
// (...)
}
This example code will parse the data received through a JSON post request.此示例代码将解析通过 JSON 发布请求接收的数据。 Afterwards, you can insert it to your Spreadsheet and generate an RSS feed usingXmlService (for more information on how to do it see this blog post).
之后,您可以将其插入电子表格并使用XmlService生成 RSS 提要(有关如何执行 此操作的更多信息,请参阅 此博客文章)。 The RSS feed can be served using the
doGet()
method.可以使用
doGet()
方法提供 RSS 提要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.