Creating a FAQ Bot in zero lines of code with Dialogflow and Webex Teams

February 14, 2019
Greg Shuttleworth
Greg ShuttleworthAssociate Systems Engineer
Creating a FAQ Bot in zero lines of code with Dialogflow and Webex Teams

Traditionally creating a chatbot requires an advanced level of programming and technical ability. At Cisco, we have drastically lowered the barrier to entry for creating Webex Teams chatbots by integrating Webex Teams with a service from Google called Dialogflow. You can now use Dialogflow to create a question and answer bot without needing to do any programming at all.

Want to see what the finished product looks like? Add our pre-made FAQ bot by adding "" to a Webex Teams space and have a play!

How it works

Dialogflow uses a feature called ‘Knowledge’ to automatically create a chatbot for Webex Teams that can instantly respond to questions. All you have to do is provide Dialogflow with a text file containing the questions and answers you want the bot to respond to.

Create a Webex Teams bot

Before we can get started with Dialogflow we first need to create a bot entity on Webex Teams. To do this create a new bot and fill in the bot details.

Take note of the bot Access Token, we will need this later. Copy it to a text file, the web site won’t show it to you again.

Integrating Webex with Dialogflow

These steps walk you through getting started with Dialogflow and integrating Dialogflow with your new Webex Teams bot.

Create Dialogflow account

Firstly, you will need a Dialogflow account. Follow these instructions to signup.

Create Dialogflow agent

Next, you’ll need to create a Dialogflow agent (This is how Dialogflow refers to an individual chatbot).

  1. Within the Dialogflow console, click Create agent in the left menu and fill in the details for your new agent.

  2. Click Create.

Add Webex Teams integration to Dialogflow agent

To make Webex Teams and Dialogflow talk to each other we need to add the integration from within the Dialogflow Console.

  1. Click on Integrations in the left menu.

  2. Turn on the Webex Teams/Cisco Spark integration (Cisco Spark is the old name of Webex Teams).

  3. Add the Access Token for the Webex Teams bot you created.

  4. Click Start

Your Dialogflow agent is now linked with your Webex Teams bot.

Create a chatbot question list

The chatbot needs a list of questions and answers that must be uploaded to Dialogflow for the agent to digest and answer questions from.

Dialogflow can accept the question list as either a simple text file or an FAQ webpage linked directly from your company website.

Your Question list is on a web page

If you have your questions and answers already on a publicly accessible web page, all you need is the web address for the FAQ page. The chatbot will import your questions and answers from it.

Create a Question list as a text file (.csv)

The question list should be a spreadsheet of questions and answers with questions in the first column and answers in the second column. This is where you can get creative!

After you’ve compiled the questions the question list must be exported as a CSV file (comma separated variable file). To do this from Microsoft Excel: File Save As File Format: CSV.

Note: There should be no headings in the spreadsheet.

CSV file containing questions and answers

Create Dialogflow knowledge base from the question list

We will now add the question list to Dialogflow’s Knowledge feature which turns the question list into a format our bot can search and use.

Turn beta features on

As of writing this (February 2019) the knowledge feature is still in beta phase, so we need to enable beta features from within Dialogflow.

  1. Click on the settings cog in the left menu of the Dialogflow console.

  2. Turn on Beta Features and APIs.

Create the knowledge base

This is where the question list will be uploaded to and stored.

  1. Click on Knowledge in the left menu of the Dialogflow console.

  2. Click Create Knowledge Base.

  3. Enter Knowledge base name and click save.

Add knowledge document

We now want to add our question list to the Knowledge Base we have created.

  1. Click create the first one to create a knowledge document.

  2. Complete the new document form (Choose FAQ as the Knowledge Type).

    a. If using a question list file: Set the Mime Type to text/csv, select Upload file from your computer and upload the question list .csv file.

    b. If using an existing FAQ webpage: Set Mime Type to text/html, select URL and enter the web address of the FAQ webpage.

  3. Click Create.

  4. Under Responses, click Add Response (leave these details as the default prepopulated values).

  5. Click Save.

You have now uploaded the questions to Dialogflow. Click on View Detail to see a list of each question and answer you have created.

Example question details in Dialogflow

Deploy the chatbot

The chatbot is now up and running. To talk to it you can use the bot's email address to add it to a space in Webex Teams and start asking questions!