How it works

This page describes the basics of how Dialogflow works and the flow from processing user input to building and sending a response.

Helping users interact with technology

Traditional computer interfaces require structured and predictable input to function properly, which makes the use of these interfaces unnatural and sometimes difficult. If users can't easily understand this structured input, they have a hard time figuring out what to do. Ideally, your interfaces should be able to infer what your users want, based on the natural language used by your users.

For example, consider a simple user request like "What's the weather forecast today?". Other users might also ask:

  • "What's the weather like right now?"
  • "What's the temperature in San Francisco tomorrow?"
  • "What will the weather be on the 21st?"

Even with these simple questions, you can see that conversational experiences are hard to implement. Interpreting and processing natural language requires a very robust language parser that's capable of understanding the nuances of language. Dialogflow handles the natural language understanding (NLU) for you, which allows your application to provide a higher quality conversational user experience.

Agents

An agent is a natural language understanding module that you build and use in your app or service. Agents understand the nuances of human language and translate user input to structured data that your apps and services can understand. A Dialogflow agent is similar to a human call center agent. You train them to handle expected scenarios involving user questions and requests, and your training does not need to be overly explicit.

For each agent, you define many intents, which categorize a user's intention and define how to map user input to actions and responses. For each intent, you define examples of possible user utterances that can trigger a match for the intent and certain types of data to extract from the utterance.

Agent extracting data from user utterance requesting weather

Intents

A basic intent contains the following:

  • Training phrases: You provide example phrases for what users might say. You don't have to define every possible example, because Dialogflow's built-in machine learning expands on your list with other, similar utterances.

  • Actions and parameters: You can also annotate your training phrases with entities, which are specific types of data that you want Dialogflow to extract from user utterances. Dialogflow extracts matched entities as parameters from the training phrases. For example, if the user says "I want a carrot", "carrot" could be a parameter value for a vegetable entity.

  • Responses: You define text, speech, or visual responses to return to the user. These may provide the user with answers, ask the user for more information, or terminate the conversation.

Agent and intent handling a user utterance

  1. When users say something, referred to as an utterance, your agent matches the utterance to an appropriate intent, otherwise known as intent classification. An intent is matched if the machine learning model for that intent can closely or exactly match the user utterance. You define the model by specifying training phrases, or examples of phrases users might say. Dialogflow takes these training phrases and expands upon them to create the intent's model.

  2. Once your agent matches an intent, it extracts parameters that you need from the utterance. This can be a color, name, date, or a host of other data categories called entities. Dialogflow provides a large set of system entities that categorize common parameters, or you can create your own. You can also annotate specific parts of your training phrases to specify the parameters you want to extract.

  3. A response is sent to the user. If more information is required, this back and forth continues.

Responses

There are multiple approaches to building responses to user requests.

Static

Intents have a built-in response handler that can return responses after the intent is matched. This feature only supports static responses that can contain extracted parameter values. In some cases, this is all you need. In cases where your code needs to take some action or build a dynamic response, you should use one of the response options below. Agents typically use a combination of static and dynamic responses, using the built-in response handler for simple responses like welcome or goodbye messages.

Answers parsed from your content

If you have content that contains answers to common user questions (for example, FAQs), Dialogflow can parse your content and automatically respond to users based on the content. For more information, see Knowledge connectors.

Fulfillment

You can enable fulfillment for an intent, which is one way to integrate your service with Dialogflow. When an intent with fulfillment is matched, Dialogflow sends a request to your webhook with information about the matched intent. After receiving the request, your webhook can perform any required tasks. The intent's built-in response handler acts as a fallback if your webhook is unresponsive.

For example, the webhook might use information from the request to look up a product in a database or place an order. Finally, your webhook should respond to Dialogflow with instructions for what Dialogflow should do next.

  1. Your agent matches a user utterance to an intent.
  2. Your agent extracts parameters from the user utterance and calls your webhook with details.
  3. Your webhook processes the request and takes any necessary actions.
  4. Your webhook constructs a response and returns it to Dialogflow, which then presents it to the user.

API

If you write code that directly interacts with your end user (for example, your company's user chat service), you don't need to use fulfillment to take actions or build dynamic responses.

The typical flow when using the API is:

  1. Your code interacts with the end user and receives a user utterance.
  2. Your code sends the utterance to Dialogflow in a detect intent request.
  3. Dialogflow responds with a matched intent, including any actions and parameters.
  4. Your code takes any necessary actions and responds directly to the user.

For more information, see Quickstart: Agent interaction using the API.

Was this page helpful? Let us know how we did:

Send feedback about...

Dialogflow Documentation
Need help? Visit our support page.