I recently received this question on my YouTube channel:
There are a few issues to consider in what seems like a pretty simple question. How much automation does Dialogflow really support when it comes to the creation of an entire chatbot?
You first need to create an agent inside Dialogflow
So, the first thing is, the very first step of the process - clicking on "Create New Agent" so you can create an agent, can only be done within Dialogflow.
While there are REST API methods to create intents, entities and contexts, there is no API call to create a new agent entirely from scratch. There probably is a good reason for this, but I am not sure what it is. (Let me know in the comments if you know)
So now that we have created a new agent, what else can we do to automate the creation of the agent so we can avoid laborious typing?
An FAQ bot
Shameless plug: Say you want to create a simple FAQ chatbot. You can actually use my Bot Generator app to take a CSV file with a bunch of intents, click a button, and get an agent ZIP file.
And even if you don't want to do that, it is still a good idea to study the structure of the agent ZIP file's JSON. Some day you can use it to automate your agent creation even if it is more complex than an FAQ chatbot.
There are two kinds of intents. You can create intents which don't need the annotation you see in the Dialogflow console, or you can create intents which do need those annotations.
For the former, you can just write a script which basically sends all the required information across to the REST API, one call per intent, using the Create Intent API call.
For the latter, though, things get a little more tricky.
Because what you need to send to your agent is actually some kind of "annotated" training phrase. This means, you need to have a way to specify your annotations in the first place. I have written about it here.
For entities, the answer is a little bit simpler, as you can create the entity types using the Create Entity Type REST API call, and then proceed to create the values within that entity using a batchCreate API call.
Usually, you will create the input and output contexts, as well as any actions and parameters as part of the Create Intent request. As you can see, the Intent object supports all these fields already. Make sure you set mlDisabled to "false" if you want to handle similar phrases, although my last section in this article (making a GET call with a predefined intent) will be helpful for avoiding these kinds of mistakes.
Create actions and parameters
Again, you will create actions and parameters as part of creating your intents using the Create Intent API call.
From what I have seen, you can only set the webhook URL from within the Dialogflow console.
Use a GET call to see example values
Needless to say, one of the simplest ways to populate a REST API call to create intents, entities and such is to create an example intent or entity inside Dialogflow first, then make an API call to GET the details, and use it as a basis for sending across your JSON for creation of new intents and entities.
Once you click on "Create New Agent" inside your Dialogflow console, you can use a bunch of REST API calls to programmatically create much of your agent.
Having said that, I also think that the feedback you get as part of typing out a training phrase and looking closely at the annotation is very useful for building your agent.
I am not a big fan of generating anything more complex than the skeleton of your chatbot using programmatic means. You probably still want to go inside your console and fine tune your bot's training phrases to get optimal results.
REST API v2 Course
Nov 2018 update: You might also be interested in my course on REST API v2.