- 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 for every 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
A simpler way to generate the CSV file
Update June 2019: It will be much easier for you to just reuse my Airtable template. Note: the signup link is a referral link which gives me free referral credits if you don't have an Airtable account, but it is free for you.
1 Sign up for Airtable
2 Make sure you are logged in
3 Click here and select Copy Base and you will get a copy of the exact format into your Airtable account. All you have to do after that is to click on "Download CSV" from the menu to get a copy of the CSV file, and you can continue following the rest of the tutorial. (You can even modify the data in the table so you can customize it even more).
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: