0

I am building an action using DialogFlow and Firebase cloud functions. I have a simple check to either ask a question or close the conversation depending on user's device type.

 if (conv.hasScreen) {
      response += `Do you want to see a picture?`;
      conv.ask(response);
      return;
  }
  else{
    conv.close(response);
    return;
  }

I tested using Google Home mini, as expected, the conversation gracefully closed. But when I tested on a phone, the if check failed and the conversation was closed again. I was expecting the contestation to continue and assistant would ask me to show a picture but it did not happen. What am I doing wrong?

Abhinav Tyagi
  • 5,158
  • 3
  • 30
  • 60
Sai
  • 2,089
  • 3
  • 19
  • 30

2 Answers2

3

It looks like the syntax is simply conv.screen. As the property hasScreen does not exist, the conditional always returns undefined, which is a falsey value.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
1

Take a look at the following to understand Surface Capabilities.

Are you using the following statement or not?

const hasScreen =
    conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT');
Abhinav Tyagi
  • 5,158
  • 3
  • 30
  • 60