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

时间:2018-05-19 16:45:48

标签: google-apps-script deployment gmail chrome-web-store gmail-addons

我开发了一个Google Apps Script来自动处理一些电子邮件(连接到Gmail),或多或少像机器人一样,并且它按预期工作。它使用Time-driven触发器Minutes timer > Every minute

每分钟运行一次

enter image description here

是否可以分发此脚本"对于其他用户(包括商业用户),还是一定是开源的? (注意:Google Apps脚本在内部使用Javascript)

我看到Deploy as web appDeploy as API executableRegister in Chrome Web StoreDeploy as web add-onDeploy from manifest,但我不知道使用哪一个来提供此功能为其他用户提供服务。

enter image description here

此外,它是否必定位于 Chrome网上应用店,还是有其他方式向客户商业分发/授予对此类应用的访问权限?

TL; DR:如何向客户分发处理Gmail电子邮件的Google Apps脚本?(需要每分钟自动运行一次)。

注意:似乎可以在此处使用Gmail加载项:https://gsuite.google.com/marketplace/category/works-with-gmail。但似乎我们不能在商业上出售附加产品。 Gmail插件是否必须免费?

enter image description here

注意:脚本链接到精确的浏览器或计算机(因此无法在特定计算机上安装浏览器扩展程序),它每分钟都会在Gmail服务器上安静地运行。 / p>

1 个答案:

答案 0 :(得分:2)

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:

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.

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. 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.

and time-driven triggers seem to be included in "simple" or "installable" category, but I'm not sure. For example, everyMinutes(n):

Specifies to run the trigger every n minutes. n must be 1, 5, 10, 15 or 30.

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

On the other hand, I see an example here with so-called 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) {
    ...