In Dialogflow, the basic flow of conversation involves these steps:
- The user provides input
- Your Dialogflow agent parses that input
- Your agent returns a response to the user
To define how conversations work, you create intents in your agent that map user input to responses. In each intent, you define examples of user utterances that can trigger the intent, what to extract from the utterance, and how to respond.
Generally, an intent represents one dialog turn within the conversation. For example, you could create an agent that recognizes and responds to users' input about their favorite color. If a user said something like "My favorite color is purple", your agent would match that input to its corresponding intent and return the response you defined within that intent. Your agent's response usually prompts users for another utterance, which your agent will attempt to match to another intent, and the conversation continues.
Intents consist of four main components that allow you to map what your user says to what your agent responds with. These components include the following:
- Intent name: The name of the intent. The intent name is passed to your fulfillment and identifies the matched intent.
- Training phrases: Examples of what users can say to match a particular intent. Dialogflow automatically expands these phrases to match similar user utterances.
- Action and parameters: Defines how relevant information (parameters) are extracted from user utterances. Examples of this kind of information include dates, times, names, places, and more. You can use parameters as input into other logic, such as looking up information, carrying out a task, or returning a response.
- Response: An utterance that's spoken or displayed back to the user.
In this document, we'll go over how your agent uses these elements to parse user input and respond appropriately.
A typical agent has several intents that represent a range of user intentions. Whenever a user says something to your Dialogflow agent, your agent attempts to match the utterance to a particular intent; then, the agent returns the response within that intent. To match user input that isn't recognized, you can create fallback intents.
Dialogflow matches user utterances to intents using the training phrases you define and the important words, phrases, or values you specify within them. The diagrams below shows the conversational flow when a user's input is successfully matched: