2

I'm trying to refresh a Gmail add-on from a promise result and I can't find the right way to do it. Is it possible, right?

What I'm doing is:

function loadAddOn(event) {
    ...
    retrieveRecipientsInformationFromAPI(emails)
    ...
    ...
    var cards =  new Array(); 
    var card = CardService.newCardBuilder();
    card.setHeader(header);

    var sectionFromInformation = CardService.newCardSection()....
    ...
    card.addSection(footer);    
    cards.push(card.build());
    return cards;
}

function retrieveRecipientsInformationFromAPI(emails) {
   var firstCall = getContactInformationFor(emails);
   var secondCall = getContactImagesFor(emails);

   Promise.all([firstCall, secondCall])
       .then(result => Logger.log(result))    <----- IS THERE ANY WAY TO REFRESH CARDS AT THIS POINT?
       .catch(error => Logger.log(error))
} 

Any idea how to update cards/addon from this response point?

Pataquer
  • 283
  • 1
  • 14
  • 1
    That do you mean by update? You can use Navigation.updateCard(Card) but I don't see any card interaction in provided example. – roma May 21 '20 at 16:07
  • Agreed with @roma, check out the example [here](https://stackoverflow.com/questions/53257853/how-can-i-add-new-sections-to-an-existing-card-on-gmail-addon) for an example. – Rafa Guillermo May 22 '20 at 08:03
  • With update I mean, I read information in email message, and I can show a basic card. Meanwhile, on background, I call three api endpoints to improve information of those recipients. Once promise.all complete, my "goal" is to update/recreate existent card with the new one or with the new information. – Pataquer May 22 '20 at 09:34

0 Answers0