简体   繁体   English

如何公开发布Google Apps脚本(处理Gmail邮件)?

[英]How to distribute a Google Apps Script (processing Gmail mails) publicly?

I developed a Google Apps Script to process some emails automatically (connected to Gmail), more or less like a bot, and it's working as expected. 我开发了一个Google Apps脚本来自动处理一些电子邮件(连接到Gmail),或多或少像机器人一样,并且它按预期工作。 It runs every minute, using a Time-driven trigger Minutes timer > Every minute : 它每分钟运行一次,使用Time-driven触发器Minutes timer > Every minute

在此输入图像描述

Is it possible to distribute this "script" for other users (including commercially), or will it necessarily be open-sourced? 是否可以为其他用户(包括商业用户)分发此“脚本”,还是必须是开源的? (note: Google Apps Scripts are using Javascript internally) (注意:Google Apps脚本在内部使用Javascript)

I see Deploy as web app , Deploy as API executable , Register in Chrome Web Store , Deploy as web add-on , Deploy from manifest , but I don't know which one to use to offer this service for other users. 我将Deploy as web appDeploy as API executableRegister in Chrome Web StoreDeploy as web add-onDeploy from manifest ,但我不知道使用哪一个为其他用户提供此服务。

在此输入图像描述

Also, will it necessarily be on the Chrome Web Store or are there other ways to commercially distribute/grant access to a customer to such apps? 此外,它是否必须在Chrome网上应用店中,还是有其他方式向客户商业分发/授予对此类应用的访问权限?

TL;DR: How to distribute to customers a Google Apps Script that processes Gmail emails? TL; DR: 如何向客户分发处理Gmail电子邮件的Google Apps脚本? (that needs to run automatically every minute). (需要每分钟自动运行)。


Note: It seems that Gmail add-ons are available here: https://gsuite.google.com/marketplace/category/works-with-gmail . 注意:似乎可以在此处获取Gmail插件: https//gsuite.google.com/marketplace/category/works-with-gmail But it seems that we cannot sell an add-on commercially. 但似乎我们不能在商业上出售附加产品。 Are Gmail add-ons necessarily free? Gmail附加组件必须免费吗?

在此输入图像描述

Note: the script is not linked to a precise browser or computer (thus it cannot be installed with a browser extension on a particular computer), it quietly runs on the Gmail server every minute. 注意:该脚本链接到精确的浏览器或计算机(因此无法在特定计算机上安装浏览器扩展程序),它每分钟都会在Gmail服务器上安静地运行。

Partial answer: 部分答案:

The page Restrictions about Gmail add-ons states that they don't provide a direct way to charge users to install an add-on: 页面对Gmail附加组件的限制声明它们不提供向用户收费以安装附加组件的直接方式:

We don't provide a way to charge users for installing add-ons, and add-ons can't include ads. 我们不提供向用户收取安装加载项费用的方法,并且加载项不能包含广告。 However, you can roll your own payment system or call into an existing billing database. 但是,您可以滚动自己的支付系统或呼叫现有的计费数据库。 Your add-on can connect to non-Google services that bill users. 您的插件可以连接到向用户收费的非Google服务。

However, it's unclear for me if it's possible to run a time-driven background task (let's say once every 15 minutes) by a Gmail add-on. 但是,我不清楚是否可以通过Gmail插件运行时间驱动的后台任务(假设每15分钟一次)。 On the one hand, I see in the Restrictions page: 一方面,我在限制页面中看到:

You can't create or use Apps Script simple or installable triggers in a Gmail add-on. 您无法在Gmail插件中创建或使用Apps Script简单或可安装的触发器。

and time-driven triggers seem to be included in "simple" or "installable" category, but I'm not sure. 时间驱动的触发器似乎包含在“简单”或“可安装”类别中,但我不确定。 For example, everyMinutes(n) : 例如, everyMinutes(n)

Specifies to run the trigger every n minutes. 指定每n分钟运行一次触发器。 n must be 1, 5, 10, 15 or 30. n必须是1,5,10,15或30。

 ScriptApp.newTrigger("myFunction") .timeBased() .everyMinutes(10) .create(); 

On the other hand, I see an example here with so-called Universal Actions : 另一方面,我在这里看到一个所谓的Universal Actions的例子:

/**
 * Run background tasks, none of which should alter the UI.
 * Also records the time of sync in the script properties.
 *
 * @param {Object} e an event object
 */
function runBackgroundSync(e) {
    ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM