Search code examples
dialogflow-esactions-on-googlegoogle-home

Actions SDK conv.hasScreen not working as expected


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?


Solution

  • 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');