I'm using Google Card Service to create a button, that when clicked should create a new Gmail draft; the draft should open for editing with a pre-populated body, and without a signature.
This is my code:
function onHomepage(e) {
var builder = CardService.newCardBuilder();
var section = CardService.newCardSection()
.addWidget(CardService.newTextButton()
.setText('Button')
.setComposeAction(CardService.newAction().setFunctionName('doStuff'),
CardService.ComposedEmailType.STANDALONE_DRAFT));
builder.addSection(section);
return builder.build();
}
function doStuff(e){
var body = 'This is a <b>test</b>'
var draft = GmailApp.createDraft('','Subject','',{htmlBody: body});
return CardService.newComposeActionResponseBuilder()
.setGmailDraft(draft)
.build();
}
The draft is created and opened for editing, the only issue is that the signature of the user is appended after the html body. I've seen other questions about adding a signature to the draft; I however need to remove it.
CodePudding user response:
Unfortunately this isn't currently possible.
I would suggest filing a feature request on Google's Issue Tracker detailing the behaviour you would like to see, I would file it either under the Apps Script component or the Workspace Add-ons component.