Sitemap

Chatbot application using Google Dialog flow chatbot Part-1

4 min readMay 19, 2022

--

Press enter or click to view image in full size

This is my first post on medium or any platform. I will try to explain everything about the chatbot app that we will develop in this post.

Prerequisite

For this application, we need a Google Dialogflow account and basic knowledge of JavaScript.

What is Google Dialogflow?

Google dialog flow is a framework to develop Chatbot applications. DialogFlow is a natural language platform and using this platform we can create and integrate conversational user interfaces in the mobile app, web app, or any other device.

Flow of application

Below is the basic flow diagram of the application we will create.

Press enter or click to view image in full size
flight booking system flow diagram
Flight booking system flow diagram

Let’s get our hands dirty.

Step-1: Login to google Dialogflow https://dialogflow.cloud.google.com

Once you will log in, you will get the below Dialogflow welcome screen.

Press enter or click to view image in full size
google dialogflow welcome screen
Welcome screen of google dialog flow

Step-2: To start with google Dialogflow, we first need to create an Agent. The agent is something like your solution in which you will write the code of your application. To create an agent click on Create Agent button.

Press enter or click to view image in full size
google dialog flow create agent
Dialogflow create agent

An agent is created with two default intents Default Welcome Intent and Default Fallback Intent.

In this article, we will use the below features of google dialog flow.

Get Shailendra Sharma’s stories in your inbox

Join Medium for free to get updates from this writer.

Intent: An intent is something that the end-user can ask or write in our chatbot app. For example, users can write Book a flight as well as please book a flight from Delhi to Mumbai. In an intent, we will handle all possible inputs provided by the user and the action that our app will take based on provided input.

Entities: Entities can be considered as the Data type available in any programming language. There are some system-defined entities available and we can create custom entities also.

Fulfillment: Fulfillment is the code that we need to write to get data from the database, API, or apply any business logic. The user will write any query in the chatbot, that query can be passed as a parameter in the fulfillment code and then we can write any business logic based on the input provided by the user.

Integration: We can integrate Dialogflow chatbot with our web application, Microsoft teams, slack, skype, Twilio, etc.

Press enter or click to view image in full size
Google dialogflow intent
Google dialogflow intents

Step -3: We can test our chatbot in the right panel of our Dialogflow screen. You can try writing hi or hello and press enter. You will get a response from Dialogflow.

Press enter or click to view image in full size
Test google dialogflow chatbot with default intents
Test google Dialogflow chatbot with default intents

Step-4: Click on Default Welcome Intent to check the properties of an intent. An Intent has the below properties.

Context: You can consider context as an input parameter and output parameter. If we have multiple intents then one intent can depend on the output of the previous intent or we need to pass data of one intent to many intents for business logic processing.

Events: Event is the feature provided by google Dialogflow to trigger intent directly. Intents are normally triggered when user expression matches intent training phrases. But using events we can trigger intent directly by using fulfillment or API.

Training Phrases: Training phrases are the inputs that end users might type or say. For intent, we can create many training phrases.

Action and Parameters: Dialogflow sends an API interaction response for each step of slot filling. For each of these slot-filling responses, the intent and action will be the same, and the parameters collected so far will be provided. When building an agent, you provide prompts that the agent will use to get parameter data from the end-user.

Response: Dialogflow sends a response to a user query. The basic response type is text response. Other response types can be an image, audio, cards, etc.

Step-5: We will use entities for the list of airports. We can use the system-defined entity “@sys.geo-city” as well but I want to make you all familiar with entities that’s why I will create a custom entity. To create an entity click on Entities.

Press enter or click to view image in full size
Google dialogflow entity
Airport Entity

Give the name Airports to the entity and provide all the possible values and synonyms that the user can enter and then click Save.

That’s it. Set up of our google Dialogflow account and agent is completed. We can test our default chatbot in a Dialogflow environment.

If you are confused right now about any of the above topics, don’t worry we will implement the application in Part-2 where we will create intents for the application and we will write fulfillment(webhook) code for backend functionality.

Source: https://cloud.google.com/dialogflow/docs

--

--