I\'m actually trying to create a Chat interface in Gmail using Add-ons with App Script. All the interactions are working. But it keeps navigating to different cards rather than
Update : Try this
function renderRootCard(){
var card = CardService.newCardBuilder();
var section = CardService.newCardSection();
var btnSet = CardService.newButtonSet();
section.addWidget(CardService.newTextParagraph().setText("old widget"));
section.addWidget(btnSet.addButton(addTaskBtn));
card.addSection(section);
var addTask = CardService.newAction().setFunctionName("addTask");
var addTaskBtn = CardService.newTextButton()
.setText("Add Task")
.setOnClickAction(addTask);
return card.build();
}
function addTask(e) {
var card = CardService.newCardBuilder();
var section = CardService.newCardSection();
var btnSet = CardService.newButtonSet();
section.addWidget(CardService.newTextParagraph().setText("old widget"));
section.addWidget(btnSet.addButton(addTaskBtn));
section.addWidget(CardService.newTextParagraph().setText("new widget"));
var addTask = CardService.newAction().setFunctionName("addTask");
var addTaskBtn = CardService.newTextButton()
.setText("Add Task")
.setOnClickAction(addTask);
return CardService.newNavigation().updateCard(card.build());
}
Original answer:
In short: Possible
I understand what you are trying to do. This involves replacing the current card by updating it with a new card that has the same widgets as that of current card and additional widgets that are required.
Let's say, you are building a to-do app. When you click add task(say), you just create the same card, add some widgets and replace the current card with a new one.