Creating a FAQ Bot in zero lines of code with Dialogflow and Webex
February 14, 2019Traditionally 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 chatbots by integrating Webex 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 "faqdevbot@webex.bot" to a Webex space and have a play!
anchorHow it works
anchorDialogflow uses a feature called ‘Knowledge’ to automatically create a chatbot for Webex 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.
anchorCreate a Webex bot
anchorBefore we can get started with Dialogflow we first need to create a bot entity on Webex . 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.
anchorIntegrating Webex with Dialogflow
anchorThese steps walk you through getting started with Dialogflow and integrating Dialogflow with your new Webex 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.
Click Create.
Add Webex integration to Dialogflow agent
To make Webex 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 integration.
Add the Access Token for the Webex bot you created.
Click Start
Your Dialogflow agent is now linked with your Webex bot.
anchorCreate a chatbot question list
anchorThe 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.
anchorCreate Dialogflow knowledge base from the question list
anchorWe 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.
Click Create.
Under Responses, click Add Response (leave these details as the default prepopulated values).
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.
anchorDeploy the chatbot
anchorThe 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 and start asking questions!