Make a friend

Alaa Guermat
WTM Algiers - We Write
6 min readJul 27, 2021

Introduction:

Chatbots are one of the necessary things nowadays, they help you get a lot of work done faster by one command away, either by typing or saying it.

Have you ever wondered how you can build your own? In this little intro to Dialogflow, you can do just that!

Now let’s get it started!

What is Dialogflow?

According to the official documentation, Dialogflow is a natural language understanding platform that makes it easy to design and integrate a conversational user interface into your mobile app, web application, device, bot, interactive voice response system, and so on.

In other words, Dialogflow is giving you the chance to make magic and create your own little friend, teaching it how to speak and interact with the living world!

I want my own chatbot … NOW!

Don’t we all just dream of creating a little talkative friend? because you can! and it’s as easy as following these steps !

  1. Get comfortable in your new home :

The first and only link you will need to visit is : Dialogflow official site, you will land on a page that looks like this.

2. Create an agent:

The word “agent” is just a fancy name for your bot that Dialogflow likes to use, you would want to click on “Create Agent”, a new page will load where you can give your creation a new identity, let’s name it something pretty…

3. What can my newborn agent do:

Just because your bot came to life, doesn’t mean it can’t have small talk ! let’s see what it can do.

On the left side of the screen, there’s a drawer called “Dialogflow Essentials”, scroll down until you find the “Small Talk” section, those are predefined answers that Dialogflow prepared for you to use and add your own touch to them, how cool is that? Don’t forget to enable it!

Well, you don’t really have to customize it if you don’t feel like it because Google did all the job for you, however it’s always a better idea to teach your bot what to say, which is the goal of this whole intro!

Now let’s give our Brainy a personality that suits it best by filling the customizable answers.

If we want to test out our progress, we can always use the column on the very right of the screen and ask Brainy questions.

The bot will randomly pick one of the answers we previously filled and use it as its own answer.

One of the many cool features that Dialogflow provides is the ability to integrate your chatbot anywhere you want, head over to the “Integrations” section in the “Dialogflow Essentials” drawer, scroll down to the “text Based” block, click and enable the “Web Demo”

Dialogflow will provide you with an HTML code that you can use in your website.

Train my chatbot

  1. Using intents

Intents are your chatbot’s vocabulary, and it is your duty to teach it all the related words to a certain situation.

Training phrases are example phrases for what end-users might say. When an end-user expression resembles one of these phrases, Dialogflow matches the intent.

Here are some examples on that:

Let’s create our own, hover over the intent button on your left and click on “Add training phrases”

Here, I added the words that best describe GDG Algiers, let’s test out our agent:

Our chatbot doesnt know what to reply because we didn’t set a reply for it to use; however, it still knows which intent is the word “Events” in.

The more intents we add, the more knowledgeable our bot becomes.

2. Using prebuilt agents

Things can get repetitive while building your chatbot, especially if you’re such a lazy person, lucky for us, Dialogflow collected many intents for us to use and make life easier.

We can access it via the “Prebuilt agents” section in our drawer.

Feel free to explore what each of those prebuilt agents do, when you decide which one needs to be used you can simply import it.

Make your bot a know-it-all

Knowledge base connector is a beta feature, therefore we need to enable beta features and APIs in the setting page.

Now by going back to the knowledge base, you should have full access to the connector.

According to the Dialogflow documentation, knowledge base provides your Dialogflow agent with the capacity to answer queries based on predetermined sources of knowledge such as websites, FAQs or knowledge base articles.

In other words, it allows you to import any type of documentation you need from the internet so your chatbot can use it. How cool is that!

Let’s use the official FAQ about Android as an example.

By clicking the create button, Dialogflow starts reading and scanning the website and extracting event information it needs to make this FAQ efficient.

Your chat bot now knows everything about Android based on its FAQ, however, if you try asking it one of the previous questions, it will now have an answer but it will know that it comes from a knowledge base.

The only way to fix this problem is by adding a response in the knowledge base.

By doing this, you are linking the knowledge learned to your bot so it can use it as a reply!

And there you go, your bot now can be a know-it-all.

Conclusion

Based on all these few steps we mentioned in this article, you should be ready to start using Dialogflow.

Knowledge doesn’t end here though, keep searching for new tips and tricks to take your new little friend to the next level!

--

--

Alaa Guermat
WTM Algiers - We Write

Masters student in computer science and WTM/GDG Algiers organizer