Dialogflow basics

This page describes the basics of using Dialogflow. You should read this page before proceeding to any other documents or quickstarts.

Help 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 end-users can't easily understand this structured input, they have a hard time figuring out what to do. Ideally, your interfaces can infer what your end-users want, based on the natural language they are using.

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

  • "What's the weather like right now?"
  • "What's the temperature going to be 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. Dialogflow handles this for you, so you can provide a high quality conversational end-user experience.

Agents

A Dialogflow agent is a virtual agent that handles conversations with your end-users. It is a natural language understanding module that understands the nuances of human language. Dialogflow translates end-user text or audio during a conversation to structured data that your apps and services can understand. You design and build a Dialogflow agent to handle the types of conversations required for your system.

A Dialogflow agent is similar to a human call center agent. You train them both to handle expected conversation scenarios, and your training does not need to be overly explicit.

Intents

An intent categorizes an end-user's intention for one conversation turn. For each agent, you define many intents, where your combined intents can handle a complete conversation. When an end-user writes or says something, referred to as an end-user expression, Dialogflow matches the end-user expression to the best intent in your agent. Matching an intent is also known as intent classification.

For example, you could create a weather agent that recognizes and responds to end-user questions about the weather. You would likely define an intent for questions about the weather forecast. If an end-user says "What's the forecast?", Dialogflow would match that end-user expression to the forecast intent. You can also define your intent to extract useful information from the end-user expression, like a time or location for the desired weather forecast. This extracted data is important for your system to perform a weather query for the end-user.

Agent extracting data from end-user expression requesting weather

A basic intent contains the following:

  • Training phrases: These are example phrases for what end-users might say. When an end-user expression resembles one of these phrases, Dialogflow matches the intent. You don't have to define every possible example, because Dialogflow's built-in machine learning expands on your list with other, similar phrases.
  • Action: You can define an action for each intent. When an intent is matched, Dialogflow provides the action to your system, and you can use the action to trigger certain actions defined in your system.
  • Parameters: When an intent is matched at runtime, Dialogflow provides the extracted values from the end-user expression as parameters. Each parameter has a type, called the entity type, which dictates exactly how the data is extracted. Unlike raw end-user input, parameters are structured data that can easily be used to perform some logic or generate responses.
  • Responses: You define text, speech, or visual responses to return to the end-user. These may provide the end-user with answers, ask the end-user for more information, or terminate the conversation.

The following diagram shows the basic flow for intent matching and responding to the end-user:

Agent and intent handling an end-user expression

Dialogflow Console

Dialogflow provides a web user interface called the Dialogflow Console (visit documentation, open console). You use this console to create, build, and test agents.

The Dialogflow Console is different from the Google Cloud Platform (GCP) Console (visit documentation, open console). The Dialogflow Console is used to manage Dialogflow agents, while the GCP Console is used to manage GCP-specific Dialogflow settings (for example, billing) and other GCP resources.

In most cases you should use the Dialogflow Console to build agents, but you can also use the Dialogflow API to build agents for advanced scenarios.

User interactions with integrations

Dialogflow integrates with many popular conversation platforms like Google Assistant, Slack, and Facebook Messenger. If you want to build an agent for one of these platforms, you should use one of the many integrations options. These integrations provide platform-specific features for building rich responses. Direct end-user interactions are handled for you, so you can focus on building your agent.

Dialogflow also provides agent import and export features for other natural language understanding platforms, such as Amazon Alexa and Microsoft Cortana.

Fulfillment for integrations

If you are using one of the integrations options, and your agent needs more than static intent responses, you need to use fulfillment to connect your service to your agent. Connecting your service allows you to take actions based on end-user expressions and send dynamic responses back to the end-user. For example, if an end-user wants to schedule a haircut on Friday, your service can check your database and respond to the end-user with availability information for Friday.

Each intent has a setting to enable fulfillment. If an intent requires some action by your system or a dynamic response, you should enable fulfillment for the intent. If an intent without fulfillment enabled is matched, Dialogflow uses the static response you defined for the intent.

When an intent with fulfillment enabled is matched, Dialogflow sends a request to your webhook service with information about the matched intent. Your system can perform any required actions and respond to Dialogflow with information for how to proceed. The following diagram shows the processing flow for fulfillment.

Diagram showing flow for fulfillment
  1. The end-user types or speaks an expression.
  2. Dialogflow matches the end-user expression to an intent and extracts parameters.
  3. Dialogflow sends a webhook request message to your webhook service. This message contains information about the matched intent, the action, the parameters, and the response defined for the intent.
  4. Your service performs actions as needed, like database queries or external API calls.
  5. Your service sends a webhook response message to Dialogflow. This message contains the response that should be sent to the end-user, which may or may not be the same as the response defined for the intent.
  6. Dialogflow sends the response to the end-user.
  7. The end-user sees or hears the response.

User interactions with the API

If you are not using one of the integration options, you must write code that directly interacts with the end-user. You must also directly interact with Dialogflow's API for each conversation turn to send end-user expressions and receive intent matches. The following diagram shows the processing flow when interacting with the API.

Diagram showing flow for API

  1. The end-user types or speaks an expression.
  2. Your service sends this end-user expression to Dialogflow in a detect intent request message (see the detectIntent method for the Sessions type).
  3. Dialogflow sends a detect intent response message to your service. This message contains information about the matched intent, the action, the parameters, and the response defined for the intent.
  4. Your service performs actions as needed, like database queries or external API calls.
  5. Your service sends a response to the end-user, which may or may not be the same as the response defined for the intent.
  6. The end-user sees or hears the response.

For an example of interacting with the API, 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.