Basic Chatbot using Dialogflow.

In this article, we will be knowing how to create a beginner-friendly Chabot using Dialogflow.

What is a Chatbot?

A chatbot is artificial intelligence (AI) software that can simulate a conversation (or a chat) with a user in natural language through messaging applications, websites, and mobile apps, or the telephone.

Chatbots are used in dialog systems for various purposes including customer service, request routing, or information gathering.

What is the Dialogflow?

Dialogflow is a natural language processing (NLP) platform that can be used to build conversational applications and experiences for a company’s customers in various languages and on multiple platforms. The Google-powered product enables developers to create text-based and voice conversation interfaces for responding to customer queries in different languages.

For example, a company can use Dialogflow to create messaging bots that respond to customer queries in platforms like Alexa Voice Services (AVS), Google Assistant, Facebook Messenger, Slack, and several other messaging integrations.

Dialogflow is the most common conversational tool used to create functionality for Google Assistant devices. The company was previously called API. AI and was acquired by Google in 2016. It was then renamed Dialogflow.

So As of now, we have learned what is the chatbot and what is google Dialogflow, Now it’s time to create our basic cafébot with the help of Dialogflow.

So let’s get started with making a chatbot.

Getting started with Dialogflow:

s1.jpg

What is an Agent?

An Agent is your actual chatbot application, so whenever you are creating a new chatbot application using Dialogflow you are going to create an Agent.

How to create an Agent let’s see that:

  • Click on Create Agent.
  • Then give any name to your agent and click on create and it will automatically create an agent in the background.

s2.jpg

What are Intents?

Intent signifies the intention of the conversation. Let’s say whenever we are starting a conversation we say hi hello and many more things and here the intention is to greet the person.

s3.jpg

In Dialogflow by default google has designed and trained two intents one is the “Welcome Intent”.

s4.jpg

In Dialogflow we can also design our own custom intents and responses and can also delete the default intents and their responses.

Let’s delete the default responses and add our own welcome responses s5.jpg

Click on Save to save the changes.

So let’s design our own intents for our cafébot.

  • Click on create intent.
  • Name your intent for example: (Book_table).
  • Add various Training Phrases of your choice.

s6.jpg

  • Now let’s add some Responses to which chatbot is supposed to reply to the specific phrase.

s7.jpg So now let’s see what are the Action and Parameters:

Action and Parameters:

Parameters are specific values extracted from the user’s request when entities are matched. The values captured by parameters can be used in fulfillment, or in building a response.

In Dialogflow there are pre-defined and default entities are there and we can also make our own custom entities.

s8.jpg

  • Here date period and date-time are the default parameters of Dialogflow.
  • If we want to extract some information from the user then we will click on the required parameter.
  • Then the Dialogflow will prompt the user if their values are not extracted from their initial request.

s9.jpg

  • Now click on the default prompt of two parameters.

  • Add the appropriate prompt you want to include for both the parameters respectively.

  • Click on close.

  • Then click on save.

s10a.jpg

s10b.jpg Yeah! we have successfully created the first intent of our cafébot. Now let’s create some more intents and train our cafébot.

  • Click on Create Intent.

  • Name your intent for example: (Order_food).

  • Add various Training Phrases of your choice.

s11.jpg

Let’s create some specific responses of your choice for the Order_food intent.

s12.jpg

  • Click on Save.

Till now we have successfully created two intents now let’s create another intent for the (menu_list). For creating the menu_list we require the custom Entities. So let’s see how to create a custom entity.

  • Click on Entities.

  • Click on Create Entity.

s13.jpg

  • Name Your Entity similarly as we have done for creating Intents.

  • Next, add the list of menu items that you want to include in your custom entity.

s14.jpg

  • Click On Save.

Yup! We have successfully created our entity now let’s use this custom. entity(Menu_lsit) in our intents. So let’s see how we are gonna use these custom entities in our intents.

Let’s create a new intent in the same way as we have done till now.

  • Click on Create Intent.

  • Name your intent for example : (Menu_list).

  • Add various Training Phrases of your choice including the elements of Custom Entities.

s15.jpg

As we can see here if we include any of the elements from the entity (Menu_list) the Dialogflow will automatically identify its parameter and train the agent.

Now let’s create the respective responses for the given phrases. To Include the respective entity element in the response we use the symbol “$” followed by the entity named in the Dialogflow.

You can see this in the new image.

s16.jpg Hurray! Till now we have successfully created our cafébot now it’s time to Run our cafébot.

Let’s see the steps to Run our café bot.

  • Click on Integrations

  • Click on Web Demo.

s17.jpg

  • Next, you will be seeing a new window with a link displayed.

  • Click on the link or open the link in the new tab.

s18.jpg

Let’s see how our Cafébot looks like.

s19.jpg Let’s Test our Cafébot.

s20.jpg

s21.jpg

s22.jpg Woohoo! Congratulations we have successfully created and designed our cafébot.

Thanks For Reading.

Written by Saba Anjum.