Home » Dialogflow | Dialogflow Tutorial

Dialogflow | Dialogflow Tutorial

by Online Tutorials Library

Dialogflow Tutorial

Dialogflow Tutorial

  • Dialogflow is a Google service which operates on a Google Cloud Platform.
  • The Dialogflow is an intuitive and user-friendly tool that includes Google’s machine learning expertise and some Google products such as Google Cloud Speech-to-Text.
  • Dialogflow is an NLP (Natural Language Processing) platform, which is used to develop an application related to the conversations and experience for the customers of the company in different languages on numerous platforms.
  • Dialogflow is mainly used to build actions for most of the Google Assistant devices.

In our Dialogflow tutorial, we are going to discuss the following topics-


What is Dialogflow

Dialogflow is defined as a Google service which operates on a Google Cloud Platform. The Dialogflow is an intuitive and user-friendly tool that includes some Google products such as Google Cloud Speech-to-Text and Google’s machine learning expertise. It is mainly used to build actions for most of the Google Assistant devices.

In other words, Dialogflow is defined as an NLP (Natural Language Processing) platform, which is used to develop an application related to the conversations and experience for the customers of the company in different languages on numerous platforms. By using Google-powered, products developers can design text-based and voice-conversation interfaces in order to answer the queries of customers in various languages. For example – various companies use Dialogflow to make messaging bots that reply to the queries of the customers on different platforms such as Google Assistant, Slack, Facebook Messenger, Alexa Voice Search (AVS), etc.


Features of the Dialogflow

There are various features of the Dialogflow:

  1. Develop serverless apps easy
  2. Deliver automated phone service
  3. Designed for a voice-first world
  4. Reply on automatic spelling correction
  5. Improve experience with built-in analytics
  6. Understand user sentiment
  7. Deploy across platforms and languages
  8. Bring your enterprise knowledge
  9. Powered by Google machine learning

Develop Serverless Apps Easy

There is a unified code editor offered by the Google Dialogflow through which we can easily develop natively serverless apps which are connected to our conversational interface via firebase cloud functions.

Deliver Automated Phone Service

With the help of the Dialogflow phone gateway, within a minute we can easily add the dedicated phone number into our Dialogflow agent and the users who call the agent with the new phone number will contact your Dialogflow agent directly. The Phone Gateway is based on the cost invested by Google in various things such as speech recognition, phone connectivity, speech synthesis, natural language processing, etc.

Designed for a Voice-First World

With a single API request, we are able to extend our conversational interface to identify voice communications and produce a voice reply. Dialogflow supports synchronous modes and real-time streaming, which are powered by the Google Cloud Text-to-speech and Cloud Text-to-Speech.

Reply on Automatic Spelling Correction

In the chat environments, most of the users interact in a hurry, and sometime there may be situations where the users do not emphasize on accurate spelling or grammar in their chats. So, in that situation, there is a feature provided by the Dialogflow named automatic spelling correction that helps to automatically spell correction mistakes with the help of the technology used by Google for search.

Improve Experience with Built-in Analytics

In the Dialogflow, the integrated analytics dashboard provides you with a vision for conversational communication. Thus, you can customize your bot to better understanding and reply to the user intentions.

Understand User Sentiment

For the query of each user, Dialogflow performs sentiment analysis, which is powered by the Cloud Natural Language. The score of sentiment analysis is used to distribute the unfulfilled users to the live agents or to gain a well knowledge about which attempts lead to the highest client feeling.

Deploy Across Platforms and Languages

It supports more than 20 languages with 14 different platforms.

Bring your Enterprise Knowledge

With the help of the Dialogflow knowledge connectors, we can easily augment data in bulk from the enterprise to the agent that contains articles based on knowledge and FAQs. To extract the correct answer from the data corpus, the knowledge connectors of the Dialogflow use those technologies used by the Google Assistant and Google Search.

Powered by Google Machine Learning

The Dialogflow tool is powered by Google Machine learning. In the Dialogflow, the understanding of the natural language identify the intent of the users and helps to extract those entities which are prebuilt like a number, date, and time. By offering a small dataset, we can also train the agent to easily recognize the customer entity types.


Use Cases of Dialogflow

There are various use cases of Dialogflow:

  1. Commerce
  2. Enterprise productivity
  3. IoT Devices
  4. Customer Service

1. Commerce: – The Dialogflow is used in business. By using Dialogflow, at any time, transactions can be possible with the users on any platform which the user prefers. If you want to purchase goods or schedule deliveries from your users, the Dialogflow provides the facility of self-service experience to those users who need rich and personalized replies.

2. Enterprise Productivity: – We can use Dialogflow for enterprise productivity. By using conversational skills inside the workplace apps makes it convenient for workers to access essential information related to the business and increase productivity, for example: offer sales with knowledge associated with the local opportunities.

3. IoT Devices: – The Dialogflow is also used in IoT devices. With the help of the conversational interface, we can make our IoT devices smarter. The Dialogflow adds an intelligent layer to the smart devices and allow devices to understand and respond precisely to the context of a user’s interactions.

4. Customer Service: – With the help of the Dialogflow, we can create conversational interfaces that are able to perform different tasks such as scheduling appointments, replies general queries, following up on previous orders, etc.


Advantages of Dialogflow

There are various advantages of the Dialogflow:

  1. Sentiment analysis
  2. User-Friendly
  3. Incorporates Google features
  4. Swift and more efficient coding
  5. Can express itself via natural conversation
  6. Can handle small talks
  7. Powered by Google’s machine learning.

1. Sentiment Analysis: – The Dialogflow can perform sentiment analysis for the queries of the user.

2. User-Friendly: – The Dialogflow is a user-friendly tool, and built with a serverless application structure and an integrated code editor.

3. Incorporates Google feature: – The Dialogflow includes various features of Google, such as speech-to-text and machine learning.

4. Swift and More Efficient Coding: – By simplifying the coding process, the Dialogflow helps us to save the time of the developers. The developers can efficiently perform all the tasks related to the coding because the system contains a built-in, inline code editor. By using this, their agents can be linked via Cloud functions or on-premise to their application.

5. Can Express itself via Natural Conversation: – With the help of Dialogflow, we can create a chatbot. And the chatbots can make a conversation in a natural manner. It simply means that although the customers speak to an application program or a computer, generally to ask for help or assistance, they will obtain in-context replies. When you communicate in a chatbot, then you will not feel like you are talking with a robotic or mechanical.

6. Powered by Google’s Machine Learning: – In Dialogflow, the machine learning technology is used and it increase the Dialogflow’s capabilities.


Why choose Dialogflow

There are various reasons for choosing Dialogflow:

  1. Multi-channel easy integration
  2. Price
  3. Natural Language Processing

1. Multi-channel Easy Integration: – The Dialogflow offers you single-click integrations to various types of the most popular messaging applications such as Twitter, Skype, Kik, Viber, Facebook Messenger, Telegram, Slack, Twilio, and also for several voice assistants such as Microsoft Cortana, Amazon Alexa, and Google Assistant.

2. Price: – The free edition of Dialogflow is also available if you only learn how to create a chatbot.

3. Natural Language Processing: – The Dialogflow uses the concept of NLP (Natural Language Processing), so the Dialogflow offers a good user experience. The agents of Dialogflow are better at NLP.


Basics of Dialogflow

Before using Dialogflow, there are various things which you should know about the Dialogflow.

Helps Users Interact with Technology

The traditional computer system needs predictable and structured input to perform function appropriately, and sometimes it makes the use of interfaces difficult and unnatural. Sometimes there may be situation where the end-users cannot grasp this structure input, and, in that situation, the end-users are having a tough time finding out what to do. Ideally, the interfaces are able to infer exactly what the end-user wants, based on the natural language end-users use.

For Example: suppose the request of the user is “How’s the weather today”? the other users can also ask:

  • How’s the weather right now?
  • How’s the temperature in London?
  • What will be the weather on 23 march?

As you know, conversational experiences are challenging to implement for these simple questions. The natural language processing and interpreting need a parser of very robust language. Dialogflow provides you this type of parser so that you can offer a good quality conversational experience to the end-users.

Agents

The Dialogflow agent is defined as a virtual agent whose task is to manage the end -user conversations. An agent is a module that can understand the complexities of the human language. During a conversation, the Dialogflow converts the text of end-user or audio into the structured data so that your applications can understand this. The Dialogflow agent is designed to manage the kinds of conversation your system needs.

The Dialogflow agent is the same as an agent in a human call center. Both are trained to handle the conversation scenario and don’t need to be over explicit in their training,

Intents

An intent classifies the intention of an end-user for one conversation turn. For every agent, we have to define various users, and our combined agent is capable of handling an entire conversation. At the time, when the end-user says or writes something which is denoted as end-user expression, then the Dialogflow check and matches the end-user expression to your agent’s best intent. Intent matching is also called Intent Classification.

For example: If you need to make an agent for the weather, which has the capability to identify and respond to the queries of the end-users related to the weather. Then you have to define an intent for the weather forecasting questions. When an end-user asks, “what is the forecast?” then the Dialogflow check and match the end-user expression to the intent of the forecast. If we want to obtain the essential information from the end-user expression such as location, time for the weather forecast according to our desire, then we have to define our intent. The obtained information is essential to the system for performing the queries related to the system.

Dialogflow Tutorial

The following things are comprised in the basic intent:

  1. Training Phrases
  2. Action
  3. Parameters
  4. Responses

1. Training Phrases: – Training phrases means an example phrases for what the end-users can say. If one of these phrases resembles an end-user expression, then the Dialogflow matches the intent. There is no need to define each possible example as the built-in machine learning of Dialogflow expands with other related phrases on your list.

2. Action: – For the agent, we can define an action. At the time, when we match an intent, then the Dialogflow gives the actions to the system, and the action can be used to trigger various actions that are already defined in the system.

3. Parameters: – At run time, if we want to march an intent then as a parameter the Dialogflow gives the value from the expressions of the end-user. Every parameter contains a type known as an entity type, and the entity type exactly dictates how data is retrieved. The parameters are not like raw input of end-user. Parameter means structured data, which is used to perform logic or produce responses.

4. Responses: – We can define speech, visual, or text replies to return to the end-user. These are able to give the answer to the end-user and also ask for more information to the end-user and can also terminate the conversation.

The below figure shows the basic flow for intent matching and responding to the end-user.

Dialogflow Tutorial

Entities

There is a type of every intent parameter, which is known as an Entity type. The task performed by the end-user is to explain how data can be extracted from the end-user expression. The Dialogflow offers you a various system entity which are predefined, which is able to match various types of common data. For example, there are various types of system entities for matching email addresses, colors, time, date, etc. For matching custom data, we can also make our custom entities. For example: we can define a fruit entity that matches the kinds of the fruits which are available to buy with the agent of a grocery store.

Dialogflow Console

Dialogflow Console is defined as a web user interface which is provided by the Dialogflow. The Dialogflow console is used to build, test, and create agents. The Dialogflow console and Google Cloud Platform Console are different from each other. The main task of the Dialogflow is to control the Dialogflow agents, and the main task of the Google Cloud Platform Console (GCP) is to handle the settings of the Google Cloud Platform (GCP) Dialogflow such as billing and some other resources of the Google Cloud Platform (GCP).

With the help of Dialogflow Console, we can also create an agent.

Context

The context of Dialogflow is the same as a natural language context. When a person tells you, “they are blue,” you have to grasp the context to know which they are referring to. In the same way, for Dialogflow, in order to handle an end-user expression, the Dialogflow context must be provided to match an intent appropriately.

To handle the flow of the conversation, contexts are used. By setting input and output contexts, that are recognized by the string names, we can configure the contexts for the intents. If the intent is matched, then for that intent, any configured output context will be active. When the contexts are in the active state then the Dialogflow try to match intent configured to the input contexts which is corresponding to the contexts which are presently active.

The below figure shows an example which uses context for the banking agent:

Dialogflow Tutorial

  • End-user asks their checking account details.
  • Then the Dialogflow try to match the expression of this end-user to the intent of There is a checking output context for this intent, which makes that reference active.
  • The Agent asks the end-user regarding which kind of information they want, related to their checking account.
  • Then the end-user provides replies by “my balance.”
  • This end-user expression matches with the intent of checking balance. There is a checking input context for this intent that should be active so that this intent can be matched. In a similar manner, there is another intent named SavingsBalance that matches a similar expression of the end-user if the savings context is active.
  • If the required database is queried by our system, then with the help of checking account balance, the agent will reply.

Follow-up Intents

The Follow-up Intents can be used to create contexts automatically for the pairs of intents. A follow-up intent means a child of the intent of its associated parent. When the follow-up intent is created, then automatically an output context will be added to the parent intent, and in the follow-up intent, the input context having a similar name will be added. A follow-up intent is matched only in one situation, and the situation is, if the parent intent is in the turn of previous conversational. Multiple levels nested follow-up intents can also be created in the Dialogflow.

In the Dialogflow, there are various types of predefined follow-up intents for the replies of the common end-user such as cancel, yes, no, etc. To manage the responses of the customer, we can also create our own follow-up intent.

User Interactions with Integrations

There are various types of conversation platforms on which the Dialogflow can integrate, such as Facebook, Slack, Google Assistant, etc. To create an agent for any platforms, you can use one of the options from the various integrations’ options. In the Dialogflow, there is a facility of handling direct end-user interactions so that your more focus is to create an agent.

User Interactions with the API

If any of the integration options you are not using, then you have to write a code that can interact with the end-user directly. For each conversational turn, you have to interact with the API of Dialogflow directly so that you can send the expression of end-user and obtain intent matches.

The below figure shows how the processing flows when interacting with the API.

Dialogflow Tutorial

  1. The End-user is speaking or types the phrases.
  2. In the detect intent request message, your service sends the end-user expression to the Dialogflow.
  3. Then, the Dialogflow sends your service a message of intent to detect an answer. The information include in the message are related to the parameter, action, the responses and the matched intent declared for the intent.
  4. Your service performs those actions which are needed, such as external API calls or Database queries.
  5. Your service sends the replies to the end-user.
  6. The end-user can hear or see the replies.

Fulfillment for Integrations

By default, the agent will react with a static response to a matched intent. You can get a more dynamic response with the help of fulfillment, if you use one of the integration options. For an intent when the fulfillment is enabled, then the Dialogflow answer to the intent by calling that service, which you define. For example: If the end-user wishes to schedule a shopping on Monday, then your service will search your database and provide the response to the end-user with details on the availability for Monday.

To enable fulfillment, every intent contains a setting option. When intent need a dynamic response or an action by your system, then for the intent, you have to enable the fulfillment. If without enabling the fulfillment, an intent is matched, it means the Dialogflow uses the static response that you defined for the intent.

If, with the fulfillment enabled, an intent is matched, then the request is sent by the Dialogflow with the information regarding the matched intent. Your system is able to perform any action which is needed and also provide a response to the Dialogflow with information to proceed.

The below figure shows the processing flow for fulfillment:

Dialogflow Tutorial

  1. An expression is typed or spoken by the end-user.
  2. With the intent, the Dialogflow matches the expression of the end-user and extracts the parameters.
  3. The Dialogflow sends a message to your webhook service for a webhook request. The message comprises the several information such as the matched intent, the response defined for the intent, the parameters, and the actions.
  4. Your Service performs various actions, such as external API calls or database queries.
  5. A webhook response message is sent by your service to the Dialogflow and the message comprises the response which is sent to the end-user.
  6. Then, the response is sent to the end-user.
  7. The end-user can hear and sees the response.

Components of the Dialogflow

There are various components of the Dialogflow:

  1. Entity
  2. Invocation
  3. Fulfillment Request
  4. Intents
  5. Response
  6. Context
  7. User says

1. Entity: – Entity is defined as a knowledge repository that is used by the agent to answer the questions of the user. There are various types of system entities, such as weather, location, date, etc.

2. Invocation: – Invocation is like saying hello to a friend.

3. Fulfillment Request: – The Dialogflow send a request to retrieve the necessary data, (sent to webhook) the webhook performs the task like determine how to respond and how to send back to the Dialogflow.

4. Intents: – Intents comprises logic and elements to parse the information of the user. It helps to map what the users are saying with the responses. There are various components in the intent, such as events, response, the user says, contexts, and action.

5. Response: – The backend system will produce a set of responses, including user calls, webhook, intentions, entities, etc.

6. Context: – The context is used to store the values of the parameter for several kinds of intent. With the help of the context, the broken conversation can also be repaired.

7. User Says: – User says means there are various forms of the same question that can be asked by the user. We can add more variations so that the agent can understand in a better way.


How to Create Your First Dialogflow Agent

There are various steps to create your first Dialogflow agent:

1. First, we have to log in to the Dialogflow. We can log in to the Dialogflow by using the link https://dialogflow.com/. After login successfully, we have to click on the Sign up for free.

Then we have to connect with the Google account. If you want to use a Dialogflow, then it is must that you have a Google account.

Dialogflow Tutorial

2. Next, we have to click on the create agent to create a new agent. For this, first select the three things: language, the default time zone, and the name for your new bot.

Dialogflow Tutorial

3. Then, create the bot say hello. The bot currently doesn’t know how to respond to the user input. The journey to teaching it how to behave is just beginning. First, you have to model the personality of the bot a bit and answer hello to him/her and then present yourself.

4. Click on the option named Default Welcome Intent.

Dialogflow Tutorial

5. Next, we have to add ‘hello’ and ‘hi’ to training phases, and these will be in the text form and then click on the enter button.

Dialogflow Tutorial

6. Next, we have to go down on the option named Responses and remove or delete the existing ones.

Dialogflow Tutorial

7. Then, click on the ADD RESPONSES, and then we have to click on the Text response Then type the response which you want.

Dialogflow Tutorial

8. When you text the response appropriately, then you have to save the response by clicking on the Save button.

Dialogflow Tutorial


How to Import the Example File to your Agent

There are various steps to import the example file to your agent:

1. First, you have to download the new-agent.zip file.

2. Then go to the Dialogflow Console.

3. Then, choose an agent.

4. Next, click on the setting icon, which is present next to the agent name.

Dialogflow Tutorial

5. Then, choose the Export and Import

Dialogflow Tutorial

6. Last, select the option named Restore from Zip and then to restore the file which you downloaded, you have to follow some instructions on each step.

Dialogflow Tutorial


How to create a New Intent

In this section, we create an agent which is capable of answering the question such as “what is your name”. for every intent we have to define various training phrases. A training phrases is also known as end-user expression. It is an example of what the possible questions the end-user can say or type to the agent. We can define any number of training phrases which offer Dialogflow, a different type of expressions which must match the intent.

There are following steps to create a new intent:

1. First, we have to click on the add intent + button on the left sidebar menu next to the intents.

Dialogflow Tutorial

2. Next, click on the get-agent-name, which is present in the Intent name

3. Then, click on the option named Add training phrases, which is present in the Training Phrases

Dialogflow Tutorial

4. Next, we enter the training phrases according to the requirement of the Intent. Then we have to click enter after every entry.

  • What is your name?
  • Tell me your name?
  • Do you have a name?

Dialogflow Tutorial

Note: In most of the cases, it is must that we have to enter at least 10-20 training phrases so that the intent matching is reliable.

5. Then, in the Response section, we have to enter the response, such as “My name is ABC” in the Text Response section.

Dialogflow Tutorial

6. Click on the Save button.

Dialogflow Tutorial

7. Then, we have to wait till the dialog of the Agent Training indicates that training is complete.

Dialogflow Tutorial

Type what is your name into the simulator? Click Enter.

Your agent gives correct responses to the expression, no matter if the expression may be a little bit dissimilar from the training phrases that you supplied.

For a machine learning model, the Dialogflow uses training phrases like an example, to match the expression of the end-user to the intents. Against each intent, in the agent, the model tests the expressions and then provides a score to each intent, and then the intent which contains the highest score is matched.

When the intent having the highest-scoring has a very less score, then the fallback intent is matched.


How to Create Parameters in Dialogflow

Whenever at runtime, the intent is matched, then as a parameter, the Dialogflow gives the values extracted from the end-user expression. And every parameter has a type which is known as an entity type. Type of entity dictates exactly how data is extracted.

There are following steps to create a parameter:

(create a new intent with parameters)

1. First, we have to click on the add intent + button on the left sidebar menu next to the intents.

Dialogflow Tutorial

2. Then, we have to give the name to the intent, and the name is as set-language, which appears at the top side of the intent form.

Dialogflow Tutorial

3. Now, we have to add the following training phrases:

  • I speak English
  • I know how to write in Spanish
  • I know French

Dialogflow Tutorial

4. Now, we click on the Save button, and then we have to wait for the Agent Training dialog indicating that Agent training completed.

Dialogflow Tutorial

Automatically, in the training phrases, the Dialogflow recognizes parameters which are known as system entities. These are the entities which the Dialogflow gives for various common data types like date, color, and location.

Note: We can annotate our training phrases manually if our training phrases are not annotated automatically.

In the Action and parameters table, the Dialogflow creates a row, which is present below the Training phrases.

Dialogflow Tutorial

  • Required: – The required parameter is optional because the checkbox is not checked.
  • Parameter Name: – The parameter name is language because it recognizes the parameter as a language.
  • Entity: – Entity is a type of entity. The entity is recognized like @language system entity.
  • Value: – Value is the identifier that you use whenever referring this parameter to its value.
  • Is List: – The checkbox of Is list is not checked. Thus, the parameter is not a list.

Note: We can also manually annotate the entity in the training phrases if it is not detected automatically.

Test your Parameter

If you want to test your parameter then first you have to type ‘I Know French’ and then press enter.

Dialogflow Tutorial

We can easily find that the Dialog extracts the language parameter appropriately with the value Spanish and Spanish is appropriately inserted where the reference of the parameter was used in the response.


How to create your own Entities

Dialogflow provides you the facility to create your entities because there may be situations when you want to gather specific data from the users, which is not given by the system entities. So, to handle this, you can create a custom entity.

There are various steps to create your own entity:

1. First, you have to click on the button add entity +, on the left sidebar menu to the Entities

Dialogflow Tutorial

2. Then for the entity name, you have to enter language-programming.

Dialogflow Tutorial

3. Now, add the below entity entries:

Dialogflow Tutorial

4. Then, click on the Save button, and then wait till the Agent Training dialog indicates that Agent training completed.

Dialogflow Tutorial

The Dialogflow can easily handle a few things such as capitalization and plurality, but for the entries, you have to add all the possible synonyms. If you add more synonyms, then the agent can quickly determine the entities.


How to Use your New Entity

If you want to make the use of the new entity, then you have to add the training phrases to the set-language.

There are various steps to use your new entity:

1. irst, click on the option named ‘Intents’, which is present on the left sidebar menu.

Dialogflow Tutorial

2. Then, click on the intent set-language.

Dialogflow Tutorial

3. Next, you have to add the various training phrases:

  • I know JavaScript.
  • I know how to code in Java.

Dialogflow Tutorial

4. Note that the programming language in these training phrases are annotated automatically and added to the section of Action and Parameters.

5. Next, you have to add another test response, which is $language-programming is a better programming language.

Dialogflow Tutorial

6. Then, click on the Save button, and then you have to wait till the Agent Training dialog indicates that Agent training completed.

Dialogflow Tutorial

Test your New Entity

If you want to test your new entity, then type I know how to code in py and press enter. We can easily see that the Dialogflow extracted the py from the parameter language-programming and recognized py as Python entity, and then in the response, value is inserted.

Dialogflow Tutorial


Contexts

We can use contexts to manage the flow of conversations.

How to Add a Follow-up Intent

The follow-up intent is used to handle the conversation. In this to handle a conversation, there is no need for manual creation of the contexts.

When the follow-up intent is created, automatically, an output context will be added to the parent intent. In the follow-up intent, the input context having a similar name will be added. Only in one situation, a follow-up intent will be matched, and the situation is if the parent intent in the previous conversational turn is matched.

There are various steps to add a follow-up intent to the set-language intent:

1. First, choose the intent Set-language that is created previously.

Dialogflow Tutorial

2. Then, we have to update the test response in the Response

Wow! Just wow! I did not know that you knew the $language.

Dialogflow Tutorial

3. Then, click on the Save button, and then wait till the Agent Training dialog indicates that Agent training completed.

4. Now, click on the Intents option, which is on the left side of the sidebar menu.

Dialogflow Tutorial

5. Hover the mouse over the intent named set-language and then click on the Add follow-up intent.

Dialogflow Tutorial

6. Then, in the revealed list, click on the Custom

Dialogflow Tutorial

7. Last, click on the Save button, and then wait till the Agent Training dialog indicates that Agent training completed.

Automatically the Dialogflow gives the name to the follow-up intent, and the named is set-language-custom.

Dialogflow Tutorial


How to customize the Default Welcome Intent

If you want to customize the default welcome intent, there are few things which you have to keep in mind regarding your greeting, and the things are set expectations, let the user take control, and welcome the user.

There are various steps to customize the default welcome intent:

1. First, click on the Default Welcome Intent.

Dialogflow Tutorial

2. Next, navigate to the Responses section.

Dialogflow Tutorial

3. Now, remove all the default responses in the Text response.

4. Then, in the Test Response, type the response such as “Welcome. I can tell you the hours of the shop, or I can arrange an appointment. What one you want?”. Click on the Save button.

Dialogflow Tutorial

5. Now, test the customize default welcome intent with the help of the simulator.

Dialogflow Tutorial

How to Create Response Variants

After creating a phrase of a new greeting, next step is to create some other variations. There are various variations responses which we include in the Default Welcome Intent:

  • Hi there. I can help you to tell you the hours of the shop, and I can arrange an appointment. How can I help you today?
  • I will tell you the hours of the store, or I can help you to schedule an appointment. How can I help you?

Dialogflow Tutorial

If you add many responses for the intent, then the Dialogflow chooses one of the responses from the list in a random way.


How to Create a Custom Intent

Here let’s take an agent of the car shop, and we want to perform two tasks from the car shop agent:

  • We want to schedule appointments for the customers.
  • We want to inform the customers regarding the operation hours.

Now first, we build an intent for the customers, which helps the users to notify regarding the operation hour’s for the car shop.

We can do this by writing a very Dialogflow sample as described below:

User: On what time you will be open.

Agent: We are available daily from 10 AM to 8 PM. Is there anything else that I should do for you?

We have to perform the following steps to make the intent which is able to handle this Dialogflow:

1. First, we have to create a new intent and give a name to the new intent as Hours.

Dialogflow Tutorial

2. Now, we enter the various training phrases in the hours intent training phrases section. On what time you will be open.

Dialogflow Tutorial

3. Next, in the Response section, we have to type the response in the table of the Text response: We are available daily from 10 AM to 8 PM. Is there anything else that I should do for you?

Dialogflow Tutorial

4. Then, we have to click on the Save button.

Add more Training Phrases

Previously, we added only one training phrase to the Hour’s intent. That is “on what time you will be open,”. This intent contains no sufficient or enough knowledge that can be helpful to recognize the other same words which have a similar meaning. So, we have to give more training phrases to the intent so that the agent can match different types of user words that can express a similar intention.

There are so many ways of forming the phrase in natural language having same meaning. We suggest that each intent starts with at least 10-20 training phrases, depending on the intent complexity. When we begin testing an agent, then using the training tool of Dialogflow, add more training phrases.

With the training phrase “On what time you will be open?”, we can add various variations that user can say instead:

  • Business hours
  • On what time you will close
  • Are you open now?
  • Are you open tomorrow?
  • When do you close?
  • What time do you open tomorrow?
  • How late can I come in?
  • Are you open today?
  • Please tell me about opening hours?

The following steps are performed to add these above variations:

1. First, click on the intent, which we have created already as Hours.

Dialogflow Tutorial

2. Then enter the above mention phrases in the Training phrases

Dialogflow Tutorial

3. Now, click on the Save

Dialogflow Tutorial

4. Then, we test the intent with the help of the simulator in the Dialogflow console.

Dialogflow Tutorial


How to Customize the Fallback Intent

In the Dialogflow, there is a Fallback Intent, which is matched when the utterance of the user did not matched with another intent. As the Default Welcome Intent, the name of the fallback intent name is Default Fallback Intent.

A Fallback intent is the one that prompts the users whose utterances are formed in such a way that the agent can understand it easily.

There are various steps to customize the fallback intent:

1. First, we have to click on the Default Fallback Intent.

Dialogflow Tutorial

2. Then, go to the Responses

3. Now, delete all the default responses which are present in the Test response section.

4. Next, we have to add the following training phrase in the Text response section:
Sorry, would you like to hear about hours, or you want to set up an appointment?

Dialogflow Tutorial

5. Click on the Save button.

Dialogflow Tutorial


Create an Intent with Parameters

Now we will build an intent which is able to schedule an appointment for the shop of the car. It is not like that intent, which we created previously. This intent can help to perform more complex tasks.

Let’s discuss the user-agent interaction that follows:

User: Hi.

Agent: Welcome. I would tell you the hours of the shop, or I can make an appointment. What one you like?

User: I want to schedule an appointment at 5 PM today.

Agent: Ok, I schedule your appointment on Monday, July 1, at 5 PM. Good-bye.

The user utterance in the Dialogflow that is “I want to schedule an appointment at 5 PM today” comprises of some essential information, which is ‘5 PM’ and ‘today’. It helps to identify at which day and time the user needs to visit the shop of the bike. The response of the agent comprises of the information regarding the date and time mentioned in the utterance of the user, which is “Ok, I schedule your appointment on Monday, July 1 at 5 PM. Good-bye.”

To identify the essential information is very easy for the human, but for the machine, it’s not an easy task. So, we have to provide the capability to the intent to extract the essential information, parameters from the utterance of the user.

Extract Information using Entities and Parameters

In a Dialogflow, there is a concept of entities and parameters. Entities and parameters are used for information extraction from the utterances of the user and then transform the extracted information into a set of parameters, and then it can be processed by systems or functions to perform several tasks.

There are various steps to create a new intent with the parameters:

1. First, we create a new intent, and to create a new intent, click on the create intent option and provide a name to the intent as Make Appointment.

Dialogflow Tutorial

2. Then, add the following training phrases in the Training phrases section:
“I want to schedule an appointment at 5 PM today”.

Dialogflow Tutorial

3. Next, we verify that the entities of the system, which are @sys.time and @sys.date, have appeared in the Action and Parameters

Dialogflow Tutorial

4. Then, we add the following response phrase in the Test response section:
“Ok, I schedule your appointment on Monday, July 1, at 5 PM. Good-bye.”

Dialogflow Tutorial

5. Then, click on the Save

By using this setup, the Make Appointment intent verifies the user statements, captures words that are mapped to the built-in system entities of the Dialogflow, which are @sys.time and @sys.date. Then, places all the captured values in the $date and $time parameters. Thus, we use $time and $date system entities in the response to the values of time and date obtained from the user statement or utterances. “Ok, I schedule your appointment on Monday, July 1, at 5 PM. Good-bye.”

In the Dialogflow, we can also create custom entities to extract uncategorized or uncommon parameters. In our case, however, the system entities are enough to capture the usual parameters like date and time.

Obtain Required Parameters using Slot-Filling

In addition to the current training phrases, now we are require to include some more training phrases, following the best practices from the previous section, which is “I want to schedule an appointment at 5 PM today”.

Now we add the various training phrases:

  • Can I schedule an appointment tomorrow at 6 PM?
  • May I arrange a noon appointment on Monday?

Dialogflow Tutorial

Till now, every training phrase includes information such as date and time, which are 6 PM tomorrow, 5 PM today, noon on Monday. But in the real world, it is not must that the user utterances always contain all the needed parameters.

Now add the below training phrases:

  • I want to fix my car on this Monday.
  • My car is cracked.
  • I would like to make an appointment on this Monday.
  • Can you fix my car?

Dialogflow Tutorial

The phrases which we used above indicate that the user needs to make an appointment or schedule an appointment. So, the new intent is able to match with such phrases to manage the job of appointment scheduling. However, the information regarding time and date are not included in the phrases. These types of phrases create problems because, without the information of time and date the intent cannot make an appointment.

So, to solve this problem, the Dialogflow offers a feature of Slot-filling, which ensures that the user gets all the required information from the user. If we want to enable the feature of slot-filling, then we have to mark the required parameters.

Suppose an intent contains necessary parameters, but it coincides with the utterance of the user, which lacks any needed parameters. In that case, the intent immediately queries the user to get all the parameters which are needed.

Let’s have a look at the following:

User: Hi.

Agent: Welcome. I can tell you the hours of the shop, or I can make an appointment. What one you like?

User: I want to fix my car.

Agent: Alright, I will help you with this. What day would you like to come?

User: Monday

Agent: And what time does it work for you?

User: 5 PM

Agent: OK, I got it. I’ve scheduled your appointment for Monday, July 14, at 5 PM. See you early. Bye-Bye.

We have to follow the following steps to make the $time and $date parameters available and include prompt questions about the parameters:

1. First, we have to click on the intent named Make Appointment.

Dialogflow Tutorial

2. Then we check the required boxes for the parameters, which are $time and $date in the Actions and Parameters Then, a column is created named PROMPTS.

Dialogflow Tutorial

3. Next, we check that if the parameter $date is located in the table below the parameter $time, then we drag the $date parameter row which is above the parameter $time. (The order in which the prompt questions are asked is decided by the placement in the table.)

Dialogflow Tutorial

5. For parameter $date, we have to click on the link named Define prompts that is present in the PROMPTS column, and then we add the prompts which are mentioned below:

  • Okay, on which day will you come in?
  • Sure, I will help you with this. What day would you like to come?
  • OK, what day would be the best suit for you.

Dialogflow Tutorial

5. Then, for parameter $time, we have to click on the link named Define prompt present in the PROMPTS column, and then we add the prompt which is mentioned below:

  • OK, what day would be best suit for you?
  • What time?
  • Now, what time would you like to schedule your appointment.

Dialogflow Tutorial

6. Click on the Save button.

Dialogflow Tutorial

7. Now, with the help of the simulator, we test the setup of the slot-filling in the Dialogflow console.

Now we have an intent to ensure that the date and time information is retrieved until a user states that they need to make an appointment.

However, currently, the intent can only respond to the mock-up response; the actual appointment cannot be scheduled. Now there is a need to make a backend process fulfillment, which is able to perform the job of appointment scheduling on Google Calendar.


Knowledgebase in Dialogflow

In the Dialogflow, there is a concept of the knowledgebase. We can define a knowledgebase as a set of knowledge document that we offer to the Dialogflow. The knowledge document comprises the information, which can be useful in the end-user’s conversations. Few of the features of Dialogflow use the concept of knowledge bases when searching for the end-user expression response.

How to Create a Knowledge Base

There are various steps to create a knowledge base:

1. First, go to the Dialog Console.

2. Then choose the agent.

3. Now, click on the option named knowledge, which is present on the left side of the menu bar.

4. Next, click on the Create Knowledge Base

Dialogflow Tutorial

5. Then enter the name of the Knowledge base and then click on the Save button.

Dialogflow Tutorial

How to Add the Document to the Knowledge Base

Currently, there is no document contained in the new knowledge base. So, we have to add the document in the knowledge base as per our need.

There are various steps to add the document to the knowledge base:

  1. First, go to the Dialogflow console.
  2. Then, choose the agent.
  3. Next, click on the option named Knowledge which is present on the left side of the menu bar.
  4. Then, click on the knowledge base name in which we want to add the document.
  5. Click on the option named Create the First One or New Document.
    Dialogflow Tutorial
  6. Then, enter the name of the document.
  7. Now, select the Mime Type, which is text/html.
  8. Next, for the Knowledge type, we have to select the option FAQ.
  9. Then, for the Data Source, choose the
  10. Now, in the URL field we have to enter the URL that is https://cloud.google.com/storage/docs/faq.
  11. Then click on the CREATE button.

Dialogflow Tutorial

Manage Knowledge Document

Manage knowledge document contains two essential points.

  1. Update knowledge document Content
  2. Delete knowledge documents
  3. List knowledge documents

1. Update Knowledge Document Content: – If you want to update the content of the knowledge document, then you cannot automatically refresh your knowledge document.

You have to call the method named Reload on the Document type to refresh the content of the public URI document or cloud storage.

If you want to refresh upload raw content, rebuild your document using the methods delete and create on the document type.

2. Delete Knowledge Documents: – If you want to delete the knowledge document, then you have to call the method named delete on the Document

3. List Knowledge Documents: – If you want to create a list of all your knowledge document, then on the Document type, use the API and call the method list.

Supported Content

There are various knowledge document types that are supported:

  1. FAQ: – The FAQ documents are the type of those documents in which the question and answer sets include like CSV or HTML.
  2. Extract QA: – Extract QA are the documents that extract unstructured test and use it for answering questions.

The below table shows the supported MIME types by source and Knowledge Type:

Knowledge TypeSource Uploaded file (Document.raw_content) (recommended) Uploaded file (Document.raw_content) ( NOT recommended)File from public URL (Document.contentUri) File from Cloud Storage (Document.contentUri)
FAQText/csv Test/csv Text/html Text/csv
Extract QA Text/plain, text/html, application/pdf Test/plain, test/html N/AText/plain, text/html. Application/pdf.

Training in Dialogflow

After training the agent to develop a machine learning model mainly for the agent, the Dialogflow uses the training data. If we want to provide the training data directly, then the Dialogflow offers you the feature of the training phrases by which we can directly enter the training data to the intents. In the Dialogflow, there is a training tool that we can also use to improve, export, and import actual conversation data and to analyze our training data.

How to Execute Training

In the Dialogflow, whenever we save the agent, then automatically, the training is executed. The Dialogflow provides the training status whenever you save your agent, and the status is in the form of a pop-up notification. Before testing the agent, we have to wait until the training completes.

When our agent contains more than 780 intents, or the automatic training status setting is disabled, then we can execute training manually.

There are various steps to execute training:

1. First, go to the Dialogflow Console.

2. Then, select the agent.

3. Now, click on the setting button, which is next to the name of the agent.

Dialogflow Tutorial

4. Then, click on the ML Settings Tab.

Dialogflow Tutorial

5. Click on the Train button which is present on the bottom of the page.

If we want to execute the training by using API, then we have to call the method named train on the agent type.

Dialogflow Tutorial

Training Tool

With the help of the training tool, we can improve the training data. It is used to review conversations with the end-users that your agent had.

With the help of the training tool, we can do the following things:

  • We can import the conversation data from the real conversations that you planned or recorded.
  • With the help of the training tool, we can analyze the real conversations and the intents that were matched for every conversation turn.
  • We can attach the expressions of the end-user from the conversations to the training phrases of the formerly matched intents, fallback intents, or the different intents.

If you want to use the training tool, then it is must that the logging is enabled because the training tool uses the history of the agent data to load the conversations. The training tool only displays the expressions of the end-user. With the help of the more complete agent history, we can view the conversation data of both agents as well as the end-user.

There are various steps to open the training tool.

  1. First, go to the Dialogflow Console.
  2. Now, select the agent.
  3. Then, click on the Training option, which is present on the left side of the menu bar.

Dialogflow Tutorial

Conversation List

When we open the training tool, then it will show you the list of conversations. This list contains all the recent conversations but in the reverse chronological order. In the list, each row gives you a summary of the conversations.

Dialogflow Tutorial

The below table describes each element of the UI.

UI Element Description
Conversation It is the first expression of the end-user in the conversation.
Requests It is the number of conversations that turned in the conversation.
No match It is the number of conversations turn for which no intent was matched.
Date The date when the conversation was imported or occurred
Dialogflow Tutorial When we used the conversation to update the training data, then for the row, the status indicator shows a green checkmark.

Intent Matching with Follow-up Intents

The follow-up intent is matched after the parental intentions are matched. So, the intent language-custom is matched only after the set-language intent is matched. Suppose the users just asked the question that how long did you know $language? Now we can add the training phrases to the question for possible user answers:

There are various steps to intent matching with the follow-up intents:

1. First, click on the Intents option, which is present on the left sidebar menu.

Dialogflow Tutorial

2. Then, click on the intent named set-language-custom.

Dialogflow Tutorial

3. Next, add various training phrases:

  • 5 years
  • About 6 days
  • For 7 years

Dialogflow Tutorial

4. Last, click on the Save button, and wait till the Agent Training dialog indicates that the Agent training completed.

Dialogflow Tutorial

Test your Follow-up Intent

If you want to test your follow-up intent, then, in the simulator, enter, I Know Spanish, and then respond to the question How long did you know Spanish with about 4 weeks.

As we know for the expression about 4 weeks, there is no response, and we can easily see that the expression is matched appropriately to the accurate intent set-language-custom. The parameter for the duration is accurately parsed (4 weeks).

Contexts and Parameters

In the context, the values of the parameter are stored. We can access the parameter values, which are defined in the intent Set-language when the output context of the set language intent is active.

In the set-language-custom, we can only ask one thing, which is the duration of the language that the user knows.

We have to perform the following steps to reference the language in the response:

1. First, update the intent set-language-custom to text the response, and the response is I cannot believe you know #set-language-followup.language for $duration!

Dialogflow Tutorial

2. Then click on the Save button, and then wait till the Agent Training dialog indicates that the Agent training completed.

Dialogflow Tutorial

The #set-language-followup.language reference is called a parameter reference for an active context.

Test the Context Parameter

If you want to test the context parameter, then type I know French in the simulator. Then answer the question as ‘one week’. Note that the value of the parameter is received from the context.

Dialogflow Tutorial


Interaction with an Integration

There are various types of conversation platforms on which the Dialogflow can integrate, such as Facebook, Slack, Google Assistant, etc. To create an agent for any platforms, you can use one of the options from the various integration options. In the Dialogflow, there is a facility of handling direct end-user interactions so that your more focus is to create an agent.

How to Enable the Integration

There are various steps to enable integration:

1. First, go to the Dialogflow Console.

2. Then, select an agent.

3. Next, click on the option named Integration present on the left sidebar menu.

Dialogflow Tutorial

4. Then, enable Web Demo integration.

Dialogflow Tutorial

When the web demo enables the dialog, the window offers you the following:

  • It provides you the URL to a web page that hosts the integration.
  • It provides HTML code so that the agent in your website can be embedded.
  • It also provides a link for the agent setting, which is used to customize the webpage aspects.

Dialogflow Tutorial

How to Interact with your Agent

If you want to interact with your agent, use the above provided link, open the webpage of the agent. This webpage gives you a text chat interface. You have to type what’s your name and then click enter. Then the agent provides the response with the response which you set up in the previous QuickStart.

Dialogflow Tutorial


How to Build Resume Chatbot for Google Assistant

There are various steps to build resume chatbot for Google assistant:

1. Google Signup

First, log in to the Dialogflow. We can log in to the Dialogflow by using the link https://dialogflow.com/. After login successfully, we have to click on the Sign up for free.

Then we have to connect with the Google account. If we want to use a Dialogflow, then it is must that to have a Google account.

Dialogflow Tutorial

2. Agent Creation

If we want to develop a new chatbot in the Dialogflow, then we have to create an agent. To create an agent, first click on the option name ‘create agent’ then, give a name to our agent, and then we have to select various things such as default time zone and default language as per our need.

Dialogflow Tutorial

3. Create New Intent

Next, we have to create a new intent. We can create a new intent by clicking on the symbol +, which is next to the intents option or by clicking on the button CREATE INTENT, which is present on the top of the Dialogflow window.

Dialogflow Tutorial

Type intent name (Introduction) and click on the Save button.

Dialogflow Tutorial

Then, in the training phrases section, there is a textbox. So, add the user expression in the textbox, and after enter, click on the Save button.

Dialogflow Tutorial

As per the intent, we need to enter the training phrases. We have to decide which type of user input is going to invoke this intent. Such as for the Introduction intent, we added “Introduce Yourself” and “Tell me about yourself’.

Then we go to the responses section. At least one response is required for each intent. So, we have to type the response in the Text response box and then press enter. After enter, the text responses, click on the Save button. Multiple responses can also be added in the responses section. Intent use responses in a random way from the list in which we have entered the responses.

Dialogflow Tutorial

4. Rich Responses

There are different types of responses available in the Dialogflow. We can have each one for different purposes so that our information is shown in a good way. For example: sometimes we may require to display some images, external links, or a list of items. Those cases lead to rich responses.

According to chat platforms such as Google, Telegram, Slack, Facebook Messenger, etc., there are various options available for the rich responses, but all the types are not supported on various chat platforms.

Dialogflow Tutorial

Now we have to click on the symbol +, which is near the default option in the response section, and then from the list choose the Google Assistant option.

Then click on the ‘ADD RESPONSES’ button, and we can see various kinds of responses.

Dialogflow Tutorial

5. Suggestion Chips in Welcome Intent

Suggestion chips are used as a guide for more conversation. Suggestion chips help to indicate what to do next, such as Introduction, Experience, Projects, contact.

Dialogflow Tutorial

6. Create Introduction Intent

For the introduction intent, we can add various training phrases such as:

  • Introduce your self
  • Introduction
  • Tell me about yourself

Dialogflow Tutorial

There are various types of responses that we can use, such as Simple Response/ Basic Card/ List/ Carousel. But we use Simple Response for this intent.

Dialogflow Tutorial

7. Create Experience Intent

We can add various training phrases for the Experience intent such as:

  • Tell me about your experience.
  • Experience

Dialogflow Tutorial

We can use table card and simple response for the response.

If we want to represent our data in a data form, then table card is used, it also offers static data.

Note: If we want to use a table card response, then it require at least one simple response.

8. Create Projects Intent

For the project intent, we can use various phrases such as:

  • Your academic projects
  • Tell me about your projects

Dialogflow Tutorial

We can use a Simple Response or Browser Carousel Card for the response.

We can scroll browser carousel card horizontally. We used this card in browser to open selected external links of the website.

9. Create Career Objective Intent

For the career objective intent, we can use various training phrases like:

  • Your career objective
  • Your goal

Dialogflow Tutorial

We can use Suggestion chips/Simple Response for the response.

Dialogflow Tutorial

10. Create an Area of Interest Intent

For the area of interest intent, we can add various training phrases such as:

  • What are your interests
  • Tell me about your interests

Dialogflow Tutorial

We can use suggestion chips or simple response for the response.

Dialogflow Tutorial

11. Create Educational Qualification Intent

For the educational qualification intent, we can use the various training phrases such as:

  • Tell me about your qualifications
  • Education
  • Educational qualifications

Dialogflow Tutorial

For the response, we have various options such as suggestion chips, simple response, and basic card.

For display images, text description, title, subtitle we can use basic card response.

12. Create Strengths and Weakness Intent

For the strengths and weakness intent, we can use various training phrases such as:

  • Tell me about your strength and weakness.
  • What are your Strengths.

Dialogflow Tutorial

We can use list and simple response for the response. With the help of the list response, we can display various items like a list.

We can see in the below image that in the response we have added the needed values. This mean that if the user clicks on the specific item, the next user input will be the key of that item.

Dialogflow Tutorial

13. Create Contact Intent

For the contact intent, we can use the various training phrases such as:

  • How can I Contact you?
  • Your contact details

Dialogflow Tutorial

For the responses, we have different kinds of options such as Text Response/ Simple Response/ Browse Carousel Card.

14. Create References Intent

For the reference intent, we can use training phrases such as:

What are your references

Dialogflow Tutorial

For the response, we can use Basic card, Simple Response, Link out suggestion, and suggestion chips. We have used link out suggestion we want to link the external website URL. Anchor text will be the title of the link.

15. Create Exit Intent

For the exit intent, we can use various training phrases such as:

  • Farewell
  • Bye bye
  • Get lost
  • Good bye
  • Bye

Dialogflow Tutorial

We can use Text Response/ Simple Response for the response.

We can see in the below figure that for end, the conversation of this intent, we select/ turn on “set this intent as end of conversation: switch/button/option.

If the user enters or type good bye, bye bye or bye then the simple response will be appear. When we make the intent as “End of conversation” then our conversation will end and user exit from the app. Now our resume chatbot has been created.

Dialogflow Tutorial


How to Build an Appointment Scheduler with Dialogflow

There are various steps to build an appointment scheduler with Dialogflow:

  1. Create a Dialogflow agent
  2. Create Intent
  3. Test the Chatbot
  4. Enable Web Integration

1. Create a Dialogflow Agent

If we want to build an appointment scheduler with Dialogflow then first we have to create a Dialogflow agent:

There are various steps to create a Dialogflow Agent:

  1. First, go to the Dialogflow console.
  2. Next, as using the Dialogflow first time, sign in with the email; otherwise, it is not required.
  3. Then accept the terms and condition, and after accepting terms and conditions, we can use the Dialogflow console.
  4. Now, we can create the agent by clicking on the Create new agent option, which on the left sidebar menu.
    Dialogflow Tutorial
  5. Then, give the name to the agent as “Appointment Scheduler” and click on the ‘CREATE’ button.
    Dialogflow Tutorial

In the Dialogflow, as a part of the agent, there are two types of default intents:

Dialogflow Tutorial

1. Default Fallback Intent: – It helps to capture those questions which the bot doesn’t understand.

2. Default Welcome Intent: – The default welcome intent is matched whenever the end-user starts a conversation with your agent.

Test the Agent

There is a testing panel in the Dialogflow console that is used to test the agent. The testing panel appears on the right side of the Dialogflow console window.

Dialogflow Tutorial

Type “Hi” to test the agent. Then the agent will respond with the default greeting, which is defined in the default welcome intent. It will say, “Greetings! “Hello! How can I help you?” we can update the response.

Dialogflow Tutorial

If we type “set an appointment,” then the agent will not be able to give the response to this because the agent does not know what to do and so it provides the response, which is defined in the default fallback intent. Because we have not created any intent that catch this specific question.

Dialogflow Tutorial

2. Create Intent

After creating the agent, we have to create the intent.

There are various steps to create the intent:

(a) First, click on the Intent option which is present on the left side of the Dialogflow window then click on the CREATE INTENT

Dialogflow Tutorial

(b) Then, click on the Training phrases and enter the various phrases:

  • I need an appointment on Saturday at 4 PM.
  • Schedule an appointment on Monday at 5 PM.
  • I’d like to arrange an appointment on Wednesday for 2 PM.

Dialogflow Tutorial

When we enter the above phrases, we will see that the date and time are automatically recognized as system entities, which are @sys.date and @sys.time.

(c) Next, go to the Responses, and in the text response section, enter “you are all set, see you then! We can also write this in another way, like “You are all set for $date at $time.” If we add a dollar($) sign, the system can easily access the entity values and click on the Add Responses.

Dialogflow Tutorial

(e) Then, click on the Save button. Then, we will test the agent.

Dialogflow Tutorial

Slot Filling

Now, “set an appointment” will be tested. This is not really clear and you didn’t need to deal with the situation. Thus, the default fallback intent handles this, and we can use slot filling for this purpose.

Slot filling enables you to build a parameter-value-collection conversation flow in a single intent. Slot filling is helpful in the situation where without a set of parameter values we cannot complete an action.

There are various steps to setup slot filling:

1. First, click on the ‘Action and Parameter’ option. Make the needed entities, and ask for the date and time in Dialogflow before answering.

2. For date, we enter or type “what date?”

Dialogflow Tutorial

3. For time, we enter or type “what time would you like to come in?”

Dialogflow Tutorial

4. Then, we click on the ‘Save’ button.

Dialogflow Tutorial

4. Test your Chatbot

Now our chatbot for appointment scheduler is ready and now we test the chatbot. To test the chatbot, we have to enter the various conversations in the testing panel of the Dialogflow console.

  • User: “hi”
  • Chatbot: “Greetings! How can I assist?

Dialogflow Tutorial

  • User: “Set an appointment”
  • Chatbot: “what date?”

Dialogflow Tutorial

  • User: “25 July”
  • Chatbot: “What time would you like to come in?”

Dialogflow Tutorial

  • User: “9AM”
  • Chatbot: “you are all set for 2020-07-25 at 09:00:00. See you then!”

Dialogflow Tutorial

Now we can see in the above screenshot that the chatbot we developed is working correctly.

5. Enable One-Click Web Integration

If we want to share the schedule with others, use the option named one-click we integration. In Dialogflow, there are various types of integration available for the chatbot. Look at a sample chatbot web user interface.

There are various steps to use one-click web integration:

1. In the Dialogflow, click on the

Dialogflow Tutorial

2. Then enable the Web Demo.

Dialogflow Tutorial

3. Next to launch the Web Demo, click on the URL.

Dialogflow Tutorial

After performing the above steps, we are able to use the chat interface. We can use the chat interface by typing something where it says ‘Ask Something’.

By using the below conversation, we can begin using the chat interface.

1. Enter “Hi” when you enter “Hi” or something then the chatbot will respond you.

Dialogflow Tutorial

2. Then, enter “set an appointment for 6 PM tomorrow” and then the chatbot will respond.

Dialogflow Tutorial


How to Build a Chatbot for FAQ with Dialogflow

There are various steps to build a chatbot for FAQ with Dialogflow:

  1. Create an agent
  2. Enable beta features and APIs
  3. Create a Knowledge Base
  4. Handle Response
  5. Test your chatbot

Create an Agent

If we want to build a chatbot for FAQ with Dialogflow, create an agent and to create an agent we have to follow the various steps:

  1. First, we have to go to the Dialogflow console.
  2. Next, if using Dialogflow first time, sign in with your email; otherwise, it is not required.
  3. Then accept the terms and conditions, and after accepting terms and conditions, we can use the Dialogflow console.

Now, we can create the agent by clicking on the Create new agent option, which is on the left sidebar menu.

Dialogflow Tutorial

(b) Next, give the name to the agent. We are building an agent for the FAQ. So, we give the related name to this as FAQ_agent. Click on the ‘CREATE’ button.

Dialogflow Tutorial

Enable Beta Features and APIs

We enable Beta features and APIs. After enabling the Beta features and APIs, we are able to create a knowledge connector.

Dialogflow Tutorial

Create a Knowledge Base

There are various steps to create a knowledge base:

(a) First, click on the option named “Create Knowledge Base.”

Dialogflow Tutorial

(b) Then, give the name to the knowledge base, and then save it by clicking on the ‘SAVE’ button.

Dialogflow Tutorial

(c)Next, a knowledge document is required, which we will use to auto-generate the chatbot of the FAQ. We use this FAQ as a sample. For this purpose, we can also use our document.

(d)Now, move back further to the Dialogflow agent, and then build our first knowledge connector.

Dialogflow Tutorial

  • Give the name to the knowledge connector. In this example, we have given the name “FAQ chatbot.”
  • Next, choose the knowledge type, which is the FAQ.
  • Then, choose the Mimi type, and in this, choose a text/html file as a Mimi type.
  • Now, add a URL to the document https://developers.facebook.com/docs/messenger-platform/faq/.
  • After performing the above steps, click on the Create

Dialogflow Tutorial

Now, the FAQ chatbot for Facebook is created by the knowledge connector, click on the Facebook FAQ.

Dialogflow Tutorial

We can see that the questions are parsed into the requests and answers.

Dialogflow Tutorial

Now, to enable the automated responses, we have to click on the Add response and then SAVE.

Dialogflow Tutorial

Before start testing our agent, firstly enable the chatbot. To enable the chatbot, click the checkbox next to the FAQ name and press enable.

Dialogflow Tutorial

Handle Responses

After creating the knowledge base and adding the FAQ, our next step is to add some variants under the Responses section to check how the chatbot must present the knowledge base’s response.

The following responses are added in the responses section:

  • I found some information for you: $Knowledge.Answer[1].
  • $Knowledge.Answer [1].
  • Here you go.$Knowledge.Answer[1].

Dialogflow Tutorial

Test your Chatbot

Now, with the help of the simulator, we can test the chatbot. To test the chatbot, type something in the simulator related to the FAQ. In this example, we created a FAQ chatbot for Facebook. To test the chatbot, we have to type the questions related to the FAQ Facebook chat, such as “Can my app use both standard messaging and message tags to send messages.” After typing this question, we will get a response from the bot. Then, we can also try some more examples like “What happens if my bot messages a person more than once beyond the 24-hour standard messaging window”. We will notice that the correct intent is still mapped even if we do not type the particular question from the FAQ. That’s the specialty of the knowledge connector.

Dialogflow Tutorial


You may also like