Some people have asked me if it is possible to programmatically create a new Dialogflow agent. Until recently, this wasn't possible. But Dialogflow recently added a method to their v2 API which allows this.
This tutorial tells you how to achieve a specific task. If you blindly follow this tutorial without understanding the ramifications for your billing/resource quote etc. then you are solely responsible for the outcomes.
- Login to your Google cloud account
If you remain logged in to your Google Cloud account, all these steps will go faster.
- Go to the agent creation documentation page
First go to the appropriate link. This is the page which describes the next steps.
Notice that you have an API explorer on the right side.
- Go to Google Cloud console and create a new project
Log in to your Google Cloud Console. Click on "Create new project"
- Copy the project ID
You need to get the projectID and not the project name.
- Go the API explorer browser window and paste the project ID
Type the following in the API explorer textbox called parent (See image):
- Go the Request body textbox and click on the plus sign
You will see that there is a dropdown with some kind of intellisense inside the Request body textbox.
- Add a field for the displayName
This will become the name of your agent.
- Click on the Execute button
Scroll down and click on the Execute button at the bottom of the page.
- Authenticate with the API explorer
You will also give permission to the API explorer to execute these commands on your account's behalf.
- Verify that you get a success message
If you see a success message, your new Dialogflow agent has been created.
- Now do the same from your code
Remember that everything you can do from the API explorer can also be done programmatically.
Now, there are a few things we haven't considered here.
Can we use an existing projectID to create a new agent? (No, because it will overwrite it)
Can we create multiple agents per project using this method? (No, for the same reason as above)
How can we automatically create a new Google cloud project in the first place so we can automate the whole thing end to end?
You can follow similar steps and use this API method, but make sure you really understand the ramifications of creating new Google Cloud projects on your billing and quote etc.
- Reader Question: What if a specific system entity isn’t available in all languages in a multi-lingual bot?
- How much can Machine Learning ACTUALLY help with answering free-form questions?
- Dialogflow Toolkit vs MBD Membership
- Dialogflow Knowledge Connector : Pros and Cons
- How to integrate Telegram with Dialogflow
- Why I avoid using slot filling (required parameters) in Dialogflow
- Free Tool: Convert your WordPress website into a Dialogflow FAQ chatbot
- Dialogflow Mega Agent Tutorial
- Reader Question: Will followup events work when an intent has an input context?
- How to learn Dialogflow in a week