如何在Gmail加载项通知中添加指向已发送电子邮件的链接

时间:2018-04-10 18:09:51

标签: google-apps-script gmail-addons

我的Gmail加载项会发送一封电子邮件,然后使用API​​ ActionResponseBuilder.setNotification显示通知,其中包含信息消息" 邀请发送电子邮件。"。一切都很好。

我的问题是如何在通知中添加新电子邮件中的链接。我认为这是可能的,因为本机Gmail通知在发送电子邮件时会这样做。它显示" 您的消息已发送。查看消息",其中"查看消息"是一个链接。

GmailApp.setCurrentMessageAccessToken(e.messageMetadata.accessToken);
var mail = GmailApp.getMessageById(e.messageMetadata.messageId);
mail.replyAll("Test email");

return CardService.newActionResponseBuilder()
  .setNotification(
    CardService.newNotification()
      .setText('Invite email sent.')  // how to add a link to new email
      .setType(CardService.NotificationType.INFO)
  )
  .build();

作为参考,包含该链接的手动发送的电子邮件的通知。 enter image description here

0 个答案:

没有答案