0

So complicated to set Dialogflow(base) agent with Actions on Google.

Using Fulfillment by Google Cloud (Firebase) Function

I already research crash logs but I don't know how to resolve this problem.

Unfortunately, Dialogflow is changing to the Google Cloud solutions and It uses Actions on Google too. That is why I cannot resolve this problem with official document.

Setting for Dialogflow Console
- Responses: I already typed a sample text response at DEFAULT. I didn't checked "Use responses from the DEFAULT tab as the first responses." at GOOGLE ASSISTANT
- Fulfillment: I checked all like "Enable webhook call...".

const {BrowseCarouselItem, BrowseCarousel, Image} = require('actions-on-google');
function carousel_1(agent) {
        let conv = agent.conv();
        conv.ask('Default Text Message.');
        conv.ask(new BrowseCarousel({
            items: getItems()
        }));

        agent.add(conv);
}
...
// Added this bottom of the full code.
intentMap.set('Carousel Intent', carousel_1);
// HTTP REQUEST
...
var cItems = new Array();
body = JSON.parse(body);

function getItems() {
   for (var i = 0; i < body.length; i++) {
      cItems.push(
         new BrowseCarouselItem({
            title: body[i].bTitle,
            description: body[i].bDesc,
            url: body[i].bUrl,
            image: new Image({
               url: body[i].bImg
           }),
           footer: 'FOOTER'
         })
      )
   }

   return cItems
}

Error Message in the Google Assistant

There is no response. Please try again later.

ybhwang
  • 3
  • 1
  • 3
  • You need to wrap it inside Promise and then return it to agent. Check this [reference](https://stackoverflow.com/a/53473177/3134215) – Ravi Aug 14 '19 at 04:59
  • is body is defined while calling the getItems() – Nikhil Savaliya Aug 14 '19 at 05:04
  • Yeah... I used "request(options, function (error, response, body)" with "options" in `getItems()`. – ybhwang Aug 14 '19 at 05:31
  • if you are using the external api make sure your billing is enabled as you won't able to request external api from cloud function if your billing is not enabled – Nikhil Savaliya Aug 14 '19 at 09:48
  • @RaviRupareliya Thank you for your advice! But I cannot resolve my problem 100%... Can you check my [CODE](https://gist.github.com/YBHwang/5a6e699ce0d701a18bd32be35a0b0d89)? – ybhwang Aug 16 '19 at 08:55

0 Answers0