1. Home
  2. Training Library
  3. Google Cloud Platform
  4. Courses
  5. Building Chatbots with Google Dialogflow: Part 2

Knowledge Base

Developed with
Calculated Systems


Building Chatbots with Google Dialogflow

The course is part of these learning paths

Start course

This course is the second part of our series on building chatbots using Google Dialogflow. In this course, we'll be taking a hands-on approach to implementing a Dialogflow chatbot, specifically focusing on the graphical user interface. You'll follow along as we cover the example of building an online banking customer service chatbot using Dialogflow.

We'll also discuss the use of databases and other knowledge sources in order to provide meaningful responses that give you the option to serve real-world information to your user. 

Learning Objectives

  • Learn what intents are and how to train your chatbot to look for them
  • Set up entities in Dialogflow
  • Understand how chatbots interact with users and how to test your chatbot
  • Learn how to connect your chatbot to a data source
  • Understand the user interfaces available with Dialogflow
  • Learn how to use the Knowledge service to build chatbots quickly and with less configuration

Intended Audience

  • Anyone looking to build chatbots using Google Dialogflow


Before taking this course, make sure you've done Part One first. To get the most out of this course, you should also have a basic understanding of: 

  • Computer science techniques
  • REST APIs and SQL
  • Google Cloud Platform

One of the cooler features that is kinda separate from the rest of Dialogflow, particularly if you've been clicking around or watching some tutorials yourself, is the Knowledge feature. This is a newer feature that's part of Dialogflow and has been for a little bit now. It's not generally available, though, so it's not free from break and changes.

So just before we move forward at all, just so you know that if you start using beta features with Google, they can change quite a bit before becoming generally released. But there's some really cool features in beta, and it could lead to some really cool projects and tests if you can handle the variability and instability.

So let's check this out, but before you're even allowed to turn it on or use Knowledge, you actually have to agree with Google to use a beta feature. You have to enable this by pressing the gear on the top left of Dialogflow and toggle on the beta features and APIs. This is off by default, so they're making you acknowledge it to click it and turn it on. And assuming this is the first time you've done this, you're not even able to start creating a Knowledge Base without doing this.

So with that enabled, what is Knowledge Base? So at its core, this is a way of taking advantage of already organized information without having to go through any of the previous steps we've discussed in Dialogflow. This means you don't need to program intents, you don't need to program entities, and you don't need to program responses, either built-in or through the backend.

You still, of course, need to have some integrations in order to route it, but that's about it. And what you're able to do with this is scan information from a CSV, a flat file, or a website, or a few other sources, and integrate it directly into your Dialogflow bot. This is immensely helpful if you already have something, such as a corporate FAQ or a help page.

Knowledge is able to take all of that and serve it up in a very rapid and easy to integrate fashion. So let's actually test it. And just to throw around some flexibility, what I'm going to show on screen is an FAQ that wasn't even designed for Dialogflow. We're just going to show you the general Broadway FAQ on how to go see shows in New York City.

So when naming a Knowledge Base, it's a little bit safer than naming an entity or intent. It's not likely that this is gonna get passed around too much in the backend, so feel free to use some spaces and non-machine safe names, but it still doesn't hurt to play it safe. And from there, you're going to quickly need to add some documents.

So these documents are where we get the information from. It's gonna contain information around where the data is and how often to check. So when creating a document, just pay attention to what type of knowledge it is. It's really designed to rapidly integrate information and knowledge, such as an FAQ from a website, but as you can see, you can also connect a few other types of files to it.

Keep in mind that this is really, really designed for servicing text-based answers and not really to integrate complex sources of data and numbers, thinking it'll automatically interpret them. And then, from the example we're discussing, we're simply gonna enter broadway.com/faq, and note that the knowledge type is FAQ and that the MIME type is type text. You can also turn on automatic reload if you want. And what this does is it periodically rescans the data. Hilariously, you're not actually able to schedule it yourself, and it happens about once a day on Google's tempo.

So once you've done, Google Dialogflow will scan the data and ingest it, and from there, you're actually able to click into it and see the details. In the case of the Broadway FAQ, you're actually able to see how it's parsed out the questions. Now, questions, such as, can I pay by credit card, what if my ticket never arrived? You can enable and disable them individually for what you want to allow and not allow, but a really cool thing to take away here is that these questions are now all fully serviceable through your Dialogflow agent.

This doesn't replace normal intent methodology. This doesn't replace anything you've previously done actually. What it does do is provide an additional option to get fulfillment for user questions. Now, you still need to tell it to give responses. However, simply click Add Responses and stick with the default settings before hitting Save. I really wish I could give you some great insights and nuance here, but this is really all you need to do to get started. Of course, you still could include some specifics about what to do if you wanna respond on Assistant versus Slack versus in a web browser. But by default, this will work quite well.

So just ensure it's enabled, and then you can actually start to test it. You can either use a test tool on the right-hand side, the Simulator, or if you've previously enabled the web demo and Dialogflow is embedded in itself, you could test it right in the bottom-right bubble or dialog box.

So here, you can see we're gonna start asking it questions. We're gonna ask, what time should I arrive to the show? And it gives you an immediate response pulled straight from the FAQ. The sequence I showed on screen is literally all of the programming that has to happen. Nothing happened behind the scenes in order to get this high level of functionality.

So this is just a quick FAQ about why you should use Knowledge Base and maybe some of the drawbacks. It's a really neat way to take advantage of existing organized information, and it's also a really good option instead of having to stick with lengthy menus.

I would recommend Dialogflow Knowledge as a really good option instead of having to scroll through long sections of text. However, I do wanna be cautious and note that this is a beta feature and Google has a history of altering its data products that are in beta as they mature.

About the Author
Learning Paths

Calculated Systems was founded by experts in Hadoop, Google Cloud and AWS. Calculated Systems enables code-free capture, mapping and transformation of data in the cloud based on Apache NiFi, an open source project originally developed within the NSA. Calculated Systems accelerates time to market for new innovations while maintaining data integrity.  With cloud automation tools, deep industry expertise, and experience productionalizing workloads development cycles are cut down to a fraction of their normal time. The ability to quickly develop large scale data ingestion and processing  decreases the risk companies face in long development cycles. Calculated Systems is one of the industry leaders in Big Data transformation and education of these complex technologies.