Search code examples
dialogflow-esactions-on-googledialogflow-es-fulfillment

DialogFlow, how to build a general intent for Yes and No responses


I'm building a DialogFlow agent for use on the Google Assistant, and it is a conversational model that mainly uses Yes and No responses to navigate through a hierarchical story. I'm struggling to design the architecture using DialogFlow Intents because there doesn't seem to be a way to create a generic, global intent that uses the system Yes and No intents. I know you can add these as Followup Intents as a child of a parent intent, but these only trigger once.

I'm using Cloud Functions on Firebase as the webhook, and will use JSON to build the responses and handle the input. Do I need to use entities to capture the responses instead? I don't think there is a system entity for yes and no.


Solution

  • There are a few ways to create global Yes/No intents:

    • Create global Yes intent and No intent. Add training phrases for the two intents.
    • Create a yes/no entity and then a Yes/No intent using the new yes/no entity
    • Make a follow up Yes intent and remove the context, which will make it a global intent. Do the same with No

    Each of these will get you global Yes/No possibilities.

    Since your story is hierarchical, a global Yes/No intent does mean that you'll need to keep track of where you are in the story (most likely with a flag in your code and adding/removing context).