dialogflow / dialogflow-fulfillment-nodejs

Dialogflow agent fulfillment library supporting v1&v2, 8 platforms, and text, card, image, suggestion, custom responses
Apache License 2.0
598 stars 281 forks source link

Cannot display Cards on Facebook Messenger and Dialogflow Messenger #333

Closed remvil closed 3 years ago

remvil commented 3 years ago

Hi all, I have a problem with Cards, I use agent.add(new Card to show a set of cards on Telgegram, so i need to replicate the same behavior for the Facebook messenger and Dialogflow messenger platforms but I can't show the cards.

var uri='some/api/uri';
return new Promise((resolve, reject) => {
   http_request(uri).then(async function(data) {
      var jsonData = JSON.parse(data);
      var resp = jsonData.d.f;
      for (let i=0; i<3; i++){
         agent.add(new Card({
            title: resp[i].nome,
            text: resp[i].indirizzo + '\nOrari di apertura: ' + resp[i].orario,
            buttonText: 'Vai in ' + resp[i].indirizzo,
            buttonUrl: 'https://www.google.com/maps/search/?api=1&query=' + resp[i].lat + ',' + resp[i].lon
         }));
      }
      return resolve();
   }).catch(function(err) {
      return resolve();
   });
 });
}

And I can see cards only on Telegram, it cannot show cards on Dialogflow Messenger and Facebook Messenger.

this function is called via intentMap.set ('search.Farmacie', myFunc); where search.Farmacie is a specific Intent. It only works on Telegram. I expect that also on Facebook Messenger and Dialogflow Messenger you can see the cards as on Telegram.

Can someone help me?