我正在使用卡服务创建一个 Gmail 插件,并且我正在尝试合并一个弹出窗口,该弹出窗口会在插件内发生特定事件时出现。在这个弹出窗口中,我想为消费者提供额外的细节或选择。
我搜索了 Google Apps 脚本文档和 Gmail 插件的说明,但无法找到在 Gmail 插件框架内制作弹出窗口的简单方法。
理想情况下,当用户单击特定按钮或在附加组件中执行特定操作时,应该显示弹出窗口。为此我应该使用哪些实用程序或库?有没有我可以用来入门的教程或代码示例?
您可以帮我使用卡服务向 Gmail 插件添加弹出窗口吗?
我知道您正在尝试使用卡片生成器为您的用户设计某种弹出通知,您可以使用现有的卡片服务新通知功能。
function buildCard() {
let cardSection1ButtonList1Button1Action1 = CardService.newAction()
.setFunctionName('TODO')
.setParameters({});
let cardSection1ButtonList1Button1 = CardService.newTextButton()
.setText('Click this for Prompt')
.setTextButtonStyle(CardService.TextButtonStyle.TEXT)
.set CardService.newButtonSet()
.addButton(cardSection1ButtonList1Button1);
let cardSection1 = CardService.newCardSection()
.addWidget(cardSection1ButtonList1);
let card = CardService.newCardBuilder()
.addSection(cardSection1)
.build();
return card;
}
function TODO() {
var actionResponseBuilder = CardService.newActionResponseBuilder()
.setNotification(CardService.newNotification()
.setText('This is a simple pop-up Warning.')
.setType(CardService.NotificationType.WARNING));
return actionResponseBuilder.build();}
*
注意:如果您对解决方案有任何疑问,请随时发表评论。此外,由于您的用例不明确,该解决方案主要是通过编译公共示例来制定的。