Creating a FAQ Bot in zero lines of code with Dialogflow and Webex TeamsFebruary 14, 2019
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 "firstname.lastname@example.org" 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).
Within the Dialogflow console, click Create agent in the left menu and fill in the details for your new agent.
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.
Click on Integrations in the left menu.
Turn on the Webex Teams/Cisco Spark integration (Cisco Spark is the old name of Webex Teams).
Add the Access Token for the Webex Teams bot you created.
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.
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.
Click on the settings cog in the left menu of the Dialogflow console.
Turn on Beta Features and APIs.
Create the knowledge base
This is where the question list will be uploaded to and stored.
Click on Knowledge in the left menu of the Dialogflow console.
Click Create Knowledge Base.
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.
Click create the first one to create a knowledge document.
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.
Under Responses, click Add Response (leave these details as the default prepopulated values).
You have now uploaded the questions to Dialogflow. Click on View Detail to see a list of each question and answer you have created.
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!