我正在运行以下范围的gmail插件:
libveins.so
我有一个按钮和相应的compose动作事件,该事件应该从某些输入字段中读取收件人,主题和身体信息,并将此信息插入到compose UI中。
撰写操作回调如下所示:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.addons.execute
https://www.googleapis.com/auth/gmail.addons.current.action.compose
https://www.googleapis.com/auth/gmail.addons.current.message.metadata
https://www.googleapis.com/auth/script.external_request
单击按钮时,加载项崩溃,并显示以下错误消息:function autofillEmailDraft(e) {
var recipient = e.formInput.recipient;
var subject = e.formInput.subject;
var body = e.formInput.body;
GmailApp.setCurrentMessageAccessToken(e.messageMetadata.accessToken);
var draft = GmailApp.createDraft(recipient, subject, body);
// Return a built draft response. This causes Gmail to present a
// compose window to the user, pre-filled with the content specified
// above.
return CardService.newComposeActionResponseBuilder()
.setGmailDraft(draft).build();
}
e.messageMetadata似乎未定义。我是否应该在其他地方寻找访问令牌?
只需删除违规行
TypeError: Cannot read property "accessToken" from undefined.
不起作用。加载项因其他错误而崩溃
GmailApp.setCurrentMessageAccessToken(e.messageMetadata.accessToken);
评论后更新:
这是触发编写操作的按钮小部件的代码:
Access denied: : Missing access token for authorization. Request: MailboxService.CreateDraft.
这是已记录的“ e”对象:
var submitButton = CardService.newTextButton()
.setTextButtonStyle(CardService.TextButtonStyle.FILLED)
.setText('Yes')
.setComposeAction(
CardService.newAction().setFunctionName('autofillEmailDraft'),
CardService.ComposedEmailType.STANDALONE_DRAFT
);