How to Create a Chatbot Using DialogFlow ? | by Dilane3 | Jul, 2021
What is DialogFlow ?
DialogFlow is a development platform created by Google that can help us to create Chatbots. It’s based on NLP (Natural Language Processing) which offers our chatbots the possibility to be very powerful.
What is the ChatBot ?
A chatBot is an intelligent program that can interact with people like a human and serves them in the specific domain where it has been created. The chatbot analyzes the intention of the client and researches the response that will be more adapted.
Now you know what DialogFlow and chatbot are, let’s see how we can create a chatbot using Dialogflow.
Note: You should have a google account and login in to the Dialogflow platform before following these steps.
In this article, we will create a chatbot that can serve clients who will want to do a reservation for a bedroom in a Hotel.
Step 1. Create an Agent
An Agent is an intelligent program inside the chatbot, it’s that program that interacts with the clients or users.
To create an Agent, go to the left section of your screen and click on the first button below the Dialogflow logo and go down to the create new agent button.
After that, the new screen will be loaded, and you will be ask to specify the name of the Agent, the language that it should be speak and the time zone. For me, I type reservation-bot for the name and the rest, i leave the default values. After that, you must click on the CREATE button and DialogFlow will create an agent for your chatbot.
Step 2. Create intents
Intents is use by the chatbot to understand what the clients or users want. It’s inside the intents that we should provide to the chatbot the examples of phrases that the clients may ask and some responses that the chatbot should use to answer to the clients. Let’s show how we can do it.
Note: When we create a new agent, it comes with two defaults intents named Default Fallback Intent and Default Welcome Intent
For create a new Intent, click on the Create Intent button
After that, you must give the name of your intent. Then go to the Training Phrases section and click on add training phrases. This section concerns the way where you should give the example of the phrase which represents the different questions that clients may ask to the chatbot. we recommend giving many examples to make your chatbot very powerful.
For this example, you could take the same phrases as me.
We have added some phrases that clients may ask to our chatbot, for your own chatbot, feel free to add another phrase to improve the power of your chatbot
In this image, we can see that two expressions are overlined. In fact, DialogFlow has identified these expressions as an entity. DialogFlow recognizes three types of entities such as systems entities, developer entities, and session entities. this night and today are recognized as systems entities, it refers to the date or period of time, this type of entity is already set in Dialogflow. Later we will create our own entities which will recognize by DialogFlow as Developer entities. For more information, check out this documentation
Now, let’s define some Responses that the agent may use to answer to clients. Go down to the Response section and click on the Add response button, and add some responses statements.
1. How Conversational AI can Automate Customer Service
2. Automated vs Live Chats: What will the Future of Customer Service Look Like?
3. Chatbots As Medical Assistants In COVID-19 Pandemic
4. Chatbot Vs. Intelligent Virtual Assistant — What’s the difference & Why Care?
You can see that inside these responses examples there are some expressions that start with the $ symbol, these expressions are considered as variables that will contain the values that clients will mention in their questions, and that DialogFlow will have recognized as a certain entity. On the image above, we have three variables such as $time-period, $date-time, and $reservation-type. $time-period and $date-time are systems entities variables and $reservation-type is a Developer entity variable, which means $reservation-type should be created by the developer, before that DialogFLow may recognize it. After added some responses that the agent should use, click on the Save button, we will come back hereafter.
Step 3. Creation of entities
In reality, entities are keywords that help the Agent to recognize what the client wants. To create it, just follow me.
Click on the Entities button
After click on the Create Entity button
After, specify the name of the entity (you should give reservation-type as name of your entity, because you have use it as variable when you gave some responses to the agent). Then, add an entity bed-room and some synonyms like below.
make sure to check the case Define synonyms before, and then click on Save button.
The role of synonyms is that, when clients should talk about bed-room, bed or room, all of this should refer to the bed-room.
Do the same with the entity reservation-action and save it.
Now, we have two entities ready to be used.
Step 4. add our entities inside training phrases expressions
back to the reservation intent interface and go to the training phrases section.
When you are there, select an expression, and inside this expression select the word bed-room like this
Then, research for @reservation-type
And click on this, and the color of bed-room will change.
Do the same thing to all the bed-room inside all expressions.
For the words booking, reservation, and reserve, do the same things but instead of research @reservation-type you will research @reservation-action.
Step 5. Definition of parameters and actions
It’s not required, but in some cases, it will be very important to obligate the user to give to the chatbot, some information.
Go down to the Actions and parameters section, always inside the reservation intent interface. you should have this image below.
For our chatbot, we want that clients provide the reservation type and the date of the reservation. Make sure to check it.
After that, we should specify the prompt text that the Agent should display to the client when they haven’t specified the required parameters. You need to click on the Define prompts… space on the right place of this section, after defining prompt text, close the box dialog.
for the date-time parameter
for the reservation type parameter
After this, save the intent.
Now you can test your chatbot.
You can test your chatbot here.
Step 6. Integration on the web platform
Click on the integrations button
You can integrate your chatbot inside of many platforms, like Facebook messenger, WhatsApp, telegram, and so on.
For this article, we are going to choose the Web Demo
click on the link, and test it again.
My Demo on my phone.
Thank you for reading…
Credit: Source link