- How to bulk upload intents from a CSV file in Dialogflow
- Automatically generate a Dialogflow FAQ chatbot from CSV file
- Reader question: Automating Dialogflow training
- App question: How to use the bot generator for Spanish?
- App question: how to add follow up intents using the Bot Generator app?
- Automatically generating a product lookup bot
In a recent post, I mentioned the tool I built which allows you to upload a CSV file and create a Dialogflow agent ZIP file. I enhanced the tool and built an app which you can download and use to do these conversions (and more). In this post, I will discuss how you can use my app to create a simple FAQ chatbot in Dialogflow.
Prepare the questions and answers
First, you need to create the list of questions and answers for your chatbot.
Create a CSV file in the appropriate format
Let us consider a very simple chatbot which provides links to popular posts on this site based on some of the queries I have received before.
The CSV format will look like this (I have opened the CSV file inside my spreadsheet program):
Note the following:
- you need to specify the IntentID once per row corresponding to a given intent. That is how the tool knows it is still processing the same intent. Here, rows 1, 2, 3 and 4 all have IntentID 1 because they are all dealing with a single intent
- you must specify the intent name once, in the same row that a new IntentID starts
- the intentIDs don't have to be sequential - for example you can use IDs like 1, 3 ,5 etc. But they have to be unique per intent
- you can have as many queries as you want under a single intent (within Dialogflow's limits)
- you can have as many responses as you want under a single intent (within Dialogflow's limits)
- the first row is ignored. The best practice is to use it for naming your columns
- the column order should be maintained
- take care to not put extra rows or columns into your CSV file - that will break the tool
Converting the CSV file
Once you have created the CSV file, you will need to upload it to my app. First, you need to get the app.
Inside the course, download the CSV2ZIP file. (Note: as I keep adding material to the course, the content may vary slightly from what you see below)
Unzip the csv2zip file. In the folder called CSV2ZIP, there will be an app.html file.
Once you open app.html, click on the "Choose File" button
Select the CSV file you created. If your CSV file is formatted as mentioned here, you should see something like the following:
Now you just need to click the "Download Agent ZIP file" green button. That's pretty much it!
Restore ZIP file to Dialogflow
Log in to your Dialogflow console and restore the agent ZIP file you just downloaded.
In the Restore popup below, choose the ZIP file you downloaded, type RESTORE and click on the RESTORE button.
You should see that the 3 intents you defined in the CSV file should appear in your agent:
And here is a demo to see how it works: