Turn your FAQ into a Chatbot using Google Sheets

Learn the easy way to train AI to answer questions without investing time in AI training.

Josh Barkin
Being Janis

--

It takes time to train AI. You need to teach a computer program, a Natural Language Processor (NLP), the inputs your business will receive and how you’ll automate responses to those inputs. Dialogflow is NLP from Google that you can train with your own data to understand the intent of a user’s message and deliver an automated response. The main paradigm for training Dialogflow NLP is to use the Dialogflow ES product, and it’s Intents and Entities. Intents group similar phrases together, while Entities can understand the meaning of words inside of those phrases. This method of training NLP gives you the control over your ability to understand the meaning of a message but it takes some time to set up. You’d need to understand the core concepts of Intents and Entities, and you’d to invest the time in adding Entities and Intents with all of your training phrases. Pre-trained Dialogflow templates from Janis.ai can help reduce the amount of time you need to spend training AI, but there is an easier and free way to start benefiting from Dialogflow NLP if you simply want to answer frequently asked questions.

Dialogflow’s Knowledge Connector, a feature of the Dialogflow ES product, turns your FAQ into a conversational experience in just a few clicks by enabling you to import from an existing data source.

You can import FAQ stored in a spreadsheet to Dialogflow to train NLP to understand basic FAQ and deliver basic text responses.

It’s the fastest way to start benefiting from Dialogflow without a major investment of time, skill, or expenses into using Google AI. Using the Dialogflow Connector lets anyone create a simple FAQ bot powered by world class AI from Google, but let’s look at the pros and cons of using the Knowledge Connector:

✅ Pros

  • Quickly create an FAQ bot with zero knowledge of Dialogflow
  • Train Dialogflow using a simple 2-column spreadsheet
  • Collaborate with others using only a Google Sheet. Just share the Google Sheet to get questions and answers. Others can be active participants in training AI without ever logging into Dialogflow
  • When you want more control or flexibility, you can later convert your Knowledge Connected FAQ bot into Dialogflow Intents.

❌ Cons

  • Limited control over your ability to train AI and get the results you want or expect. Google’s NLP does everything for you but accuracy is entirely in the hands of AI.
  • Simple text responses only. It’s ideal for simple chatbots and voice agents to answer FAQ.

Let’s Get Started

Here is a Google Sheet I created with 2 columns (Click the link for a template). There is one column for a questions and one for the answers.

Keep reading, or you can watch this video and I’ll show you how to use my Google Sheets example and import that to Dialogflow, as well as how you can import FAQ published to a website directly to Dialogflow using the Knowledge Connector.

How it Works

The NLP Knowledge Connector isn’t completely a black box. It’s good to understand how it works so you can then optimize your knowledge base, or if you’re not satisfied with the results, then you can consider converting your Knowledge Connector NLP to standard Dialogflow Intents.

Google will analyze a message received and an answer match with the highest Confidence Score wins and the matching response will be sent to the user.

Users will input messages in different ways. A perfect match would be scored as 1 (100%), but Dialogflow will compare similar messages. If a user asked a restaurant or ecommerce chatbot “Where’s my order?” but the question answer set that you imported to Dialogflow was: Why hasn’t my order arrived yet? this isn’t a perfect match but the user’s message would produce a Confidence Score well above 0.9.

If a user asks “Can I pick up my order?” then you’d get a lower Confidence Score from Google, but with a 75% match, it’s sill considered a reasonable match.

Google will find multiple matches and rank them in order of confidence, but only the question and answer set with the highest Confidence Score would be returned to the user. As a result, you’ll want to have a fairly deep set of FAQ to give Dialogflow the best chance at finding the best matches to questions.

Importing Your Google Sheet to Dialogflow

You’ll want to login to the Dialogflow console and select your Dialogflow agent from the top left corner of the screen. If you haven’t set up a Dialogflow account yet, then Janis.ai is an AI assistant that can create a Dialogflow account for you and help you get started.

If you have not yet imported a Google Sheet before to Dialogflow, you first need to Enable beta features and APIs and you can do that in the settings for your Dialogflow agent. Click on the ⚙ icon on the left side panel next to the Dialogflow agent name to access your Dialogflow agent settings.

Under the BETA FEATURES heading, turn on the switch to Enable beta features and APIs option:

Step 1: Create a Knowledge Base

In the navigation bar, click on the Knowledge option and then click the button in the top right to CREATE KNOWLEDGE BASE.

Give your Knowledge Base a name and save it. For my example, a chatbot for restaurants, I’ve given my Knowledge Base the name FAQ-Restaurants

Step 2: Add a Document to the Knowledge Base

Now you’ll need a document (Your Google Sheet) to import to the Knowledge Base.

If you haven’t done so already, you can make a copy of this Google Sheet template with some example question and answer sets. Feel free to edit, delete, and add new questions, but only ensure that data you want imported into Dialogflow appears in the cells, and make sure that your Google Sheet always has a header row to indicate which are the questions and which are the answers!

Once you’ve added your questions and answers into a Google Sheet, choose File > Download > Comma Separated Values (CSV) to export the specific worksheet and save the .CSV file to your desktop.

Now go back to Dialogflow and click on the link “Create the first one” since you’ll be creating your first Knowledge Base.

Give your document a name. It’s a good idea to name the document in a way that reflects the source of the knowledge, since you can add multiple documents (more than one Google Sheet, or a Google Sheet and a Website) to the same Knowledge Base.

For the Knowledge Type select FAQ and for the Mime Type select text/csv. You can upload different document types (html, text file, PDF, etc.) to Dialogflow but we’re going to import that .CSV we exported from Google Sheets and downloaded to our desktop.

Next, select the file from your computer and upload it to Dialogflow!

Step 3: Verify your data

You’ll see your document has now been uploaded and if you click the link to View Detail you’ll see how Dialogflow created your FAQ data set.

See how the document is parsed into Questions and Answers?

Step 4: Enable automated responses

Click the ADD RESPONSE link to enable automated responses.

You’ll see how Dialogflow will add a text response and $Knowledge.Answer[1] which appears in the response is a command Google adds to refer to your document for the answers. You do not want to enter anything else into this field.

Now click the blue Save button in the top right corner of your screen.

You can always ENABLE and DISABLE your Knowledge Base responses. You simply select the document from the list and click Disable if you want your chatbot to ignore your Knowledge Base automated responses. Make sure Enable is selected however so you can test it out.

Step 5: Test it out

If you’ve already connected Dialogflow to a conversational channel (i.e. Facebook Messenger) you can message your Chatbot directly and try any of the questions to see your responses. However, even if you’re not ready to go live with your chatbot and you have not yet connected Dialogflow to a conversational channel, you can use the Dialogflow simulator to test.

If you want to see how Dialogflow arrived at the response, you can click the Diagnostic Info button. Dialogflow will give you a block of raw code from the API response but that’s where you’ll be able to see the Confidence Score.

Making Changes

If you edit your Google Sheet because you want to add, edit, or remove questions and answer sets, you’ll want to update your Knowledge Base. You can simply add a new document by following the same steps described in this tutorial, then select the first document you imported to Dialogflow and delete it.

You can see above how I’ll rename by Google Sheet when I make changes so that I know which is the original and which is the updated version.

Congratulations! You have an AI-powered FAQ bot!

If you’ve followed the steps above to create a question and answer set in Google Sheets and import that to Dialogflow with the Knowledge Connector, then you’re already benefiting from automation with AI from Google and a Dialogflow Knowledge Base. You can start to see that NLP can help you automate without a major investment of time and money so you can start boosting revenue, reducing costs, and delighting your customers 24x7.

Taking it a step further

Using Google Sheets is an easy way to set up a simple FAQ bot and benefit quickly, but you’re fairly limited with what you can do. Let’s now look at how you can turn your Dialogflow Knowledge Base into Dialogflow Intents, which gives you more control over automation, by manually grouping similar questions or phrases together and the ability to create richer and more dynamic responses.

If you want to turn your Knowledge Base into Dialogflow Intents, click view detail for your Knowledge Base document

Select a question/answer pair from the document, or click the box at the top to select all, and then click the button to Convert to Intents

When the conversion is complete, your question/answer pairs used for your Knowledge Base will be automatically disabled.

If you click into Intents, you’ll see that Dialogflow created Intents from your selected question/answer pairs and automatically generated a name for each intent.

If you click into an Intent then you can see how the question has become a training phrase:

…and the answer for the FAQ has been added to the response section of the Intent.

Now, you’ll probably want to edit the name of the Intent so it’s easier to understand and reference in the future, and for each Intent you can start to add similar training phrases. This way, when users send different messages, because the messages are grouped together, you’ll know the Intent of the user and can deliver the same response. When using the Knowledge Connector, Google will automatically determine similar messages and rank them with a Confidence Score, but with Intents, you have control over what users might say and how they are grouped together. It takes time, and templates definitely help by saving you a ton of time, but you’ll benefit more from NLP in the long run.

In addition to adding and grouping similar Training Phases you have more control over your responses including the ability to redirect your response to another chatbot platform such as Manychat, or Chatfuel which provide visual flow building tools and the ability to store data when users send messages (Dialogflow doesn’t provide this except for a 20 minute chat session)

If you started working with Dialogflow Intents and you’re still using the Knowledge Connector (with your Google Sheet import), then you’ll want to tell Dialogflow which NLP engine to use (Intents, or Knowledge Connector) when you receive messages by adjusting the weight. If you want to search the Knowldge Base, set that to Stronger.

As you gradually build out your Dialogflow, you’ll set the Knowldge Base to Weaker and Dialogflow will trigger Intents more when it receives messages.

You can learn more about the Knowledge Base, Dialogflow Intents, and building AI-enhanced conversational experiences in the Janis Community, and if you want to take a deep dive and better understand how to set up Dialogflow Intents, consider taking my Dialogflow Course.

More Things You Can Do With Dialogflow and Google Sheets

I like using Google Sheets with chatbots because it can serve as a simple way to collaborate on content, but you can also use Google Sheets as a database for content, and when users send a message to a chatbot, you can dynamically search Google Sheet rows and dynamically generate a response with data in those rows. It makes it really easy to manage frequently changing content in a chatbot, and gives people without any knowledge or experience working with Dialogflow a chance to be active participants in building and managing a chatbot.

--

--

Josh Barkin
Being Janis

Building conversational AI platforms since 2016