What is Dialogflow?

Dialogflow (previously API.ai) is one of the leading chatbot builder platforms. It uses NLP which enables to build and implement an interactive interface for mobile and web apps.

In this article, I will show you how to create a simple chatbot using Dialogflow. You will find details about the tools and the technology used while building a chatbot.

The article also has a walkthrough of Dialogflow tutorial and outlines the chronological flow, so that by the time you finish reading, you will have a basic idea of how to create a chatbot like RepoFinder.

Let us now dwell on the question that why do you need chatbots.

Why do you need a chatbot?

Gartner predicted that by 2020, 85% of customer interactions will be managed without a human. Who would do that? – bet your money on chatbots.

Google also declared an imminent shift from a mobile-first world to an AI-first world. Companies across various industries are riding the wave and have deployed AI-powered chatbots for their businesses.

Chatbots, if they can fulfil their potential will be much more sophisticated than traditional apps. They can understand natural human language, by virtue of which, chatbots will be much more interactive and engaging.

As AI improves in the future, talking to a chatbot will be like talking to someone who has the empathy of a real human and a brain reminiscent of Google.

Now let’s get back to building a bot.

Bonus: How to build chatbots without any coding?

How to create chatbots using google Dialogflow?

Required tools and technology :

  • Dialogflow: Bot framework to create intelligent chatbots, which you can then integrate with your apps.
  • Node.js: To define the fulfilment logic, which eventually processes the data.
  • Kommunicate: Once you build your chatbot with Dialogflow then you can easily add it to your website or apps using Kommunicate. If you don’t have a/c, please signup here for free.

Now let me help you get familiar with DialogFlow, but first, a little about the project as I will be drawing inferences from it in the course of this article:

Creating your first chatbot — RepoFinder (Project Name) – RepoFinder helps you find open source development libraries from Github, based on your input.


6. Integrating into the website


Creating Agent

Sign up for Dialogflow and open your dashboard. The first step is creating an agent, which essentially is the bot you are building. You can create one through the console by following these instructions. In our case, we’ve named it RepoFinder.

Creating Intents

Next, you will have to create Intents. Intents basically help the bot perceive the user’s input and decide the subsequent action. Intents can be created both from the console or by calling APIs.

DialogFlow by default gives two intents: Default Fallback Intent, Default Welcome Intent.

More Information on creating Intents can be found here.


Creating Entities

Once Intents are created, you need to define entities. Entities are powerful tools used to extract parameter values from the user’s query. Any actionable data that you want to get from a user’s request, should have a corresponding entity.

Consider our agent RepoFinder. The user says “Tell me the best Chat SDK on GitHub” — this should tell the agent that the user needs some info on Chat SDK.

So how do you configure the agent to do it? Well, for each user expression mapped to an intent, the agent needs to figure out the respective input that the user wants info about. This, the agent does with the help of Entities.

So for each intent that you create, every user expression should contain a corresponding entity, which your bot agent needs to figure out. Now by default, the agent can’t do that — you need to train it to do so.


Training the Agent

Dialogflow provides a training tool that allows you to add annotated examples to relevant Intents in bulk (see screenshot below). It helps to improve the classification accuracy of the agent. Here you will also receive a log of all the queries sent to your agent and what the agent responded in return.

This is very useful if you tell your agent something and it responds with an output you don’t like. It can also be helpful if you realize later on that you forgot a synonym of an entity and users are using that a lot, then you can go and tell your agent what to do in that case.



Now your chatbot is all set to function. Every time it receives a query, it will first capture the intent and then extract the entity. The next step is to generate a response, which the user is ideally seeking. This you can do by leveraging webhooks to fetch data from external sources (GitHub API server in our case). You can do this in the Fulfillment Section, by specifying the webhook URL.

The penultimate step is to tell the intent to use this webhook to respond with the data that was returned from it.

Integrating RepoFinder in Application/Website

For detailed instructions on how you can use your newly created bot on a website are given here. You need not write any code for integrating a bot in your website, just use Kommunicate chat interface for that.

If you want to do it on the code level, follow the below instructions.

The image below demonstrates the integration architecture and the sequence of information flow:

    1. User comes to the website and asks for the required library.
    1. The website uses Kommunicate APIs to send messages to the application server.
    1. The application server sends the query to Dialogflow agent.
    1. The agent uses machine learning algorithms to match the user’s requests to specific intents and uses entities to extract relevant data from them → thereby processes natural language to convert it to actionable data.
  1. RepoFinder returns the actionable result to the application server

    A part of Response of RepoFinder look like this:

     “parameters”: {
     “keyword.original”: “chat”,
     “keyword”: [“chat”]

    Dialogflow agent’s response with all the details available here.

  2. Application server calls Github search APIs/internal database to get the list of libraries related to the keyword.

  3. The application server then sends the list of libraries back to User again by calling Applozic APIs.

That is pretty much all you need to do in order to build a simple bot in Dialogflow.

Are you considering chatbots for your business? Download the Complete Beginner's Guide to Chatbots 
for a more detailed explanation on chatbots' capabilities, industry use-cases and a step-by-step guide 
on how to build one.

You can checkout RepoFinder here. You can get the full project with source code on Github.

Just play around with Intent, Entities, and Action to build your own flow and chatbot. We can’t deny the fact that chatbots are going to handle most of our customer interactions; starting now would definitely set you on pace with your competitors. Here is a video tutorial for you:


Related Reads:

  1. Dialogflow vs Rasa: Which one to choose for building chatbots
  2. Integrate Dialogflow bot into your apps and websites
  3. What is a chatbot and how to use it for your business?

Subscribe here to get the good stuff — we solemnly swear to deliver top of the line, out of the box and super beneficial content to you once a week.

At Kommunicate, we are envisioning a world-beating customer support solution to empower the new era of customer support. We would love to have you onboard to have a first-hand experience of Kommunicate. You can signup here and start delighting your customers right away.