Refresh Gmail add-on from promise response

100 Views Asked by At

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?

0

There are 0 best solutions below