Still updating your Dialogflow agent manually? In this post you're going to learn how to use the Jovo CLI and Dialogflow v2 API to deploy a Dialogflow agent from your command line.
- Step 1: Setting up Authentication
- Step 2: Deploying your Agent with the Jovo CLI
Making changes to Dialogflow (the natural language understanding platform that is used for Google Assistant projects in Jovo) can be tedious if you want to keep it up to date with the Jovo Model. Usually, you have to do one of the following in the Dialogflow Console:
- Update the language model manually
- Create the _dialogflowagent.zip file with jovo deploy jovo deploy --platform googleAction
- Restore the _dialogflowagent.zip to your existing Dialogflow agent in the preferences:
- Check the 'Validation' tab of the agent for any problems
Can become quite annoying, right?
Finally, you can use the command line to update your Dialogflow agent automatically! Since Jovo v1.0, we support the Dialogflow v2 API which allows you to set up an authentication for programmatic deployments. There are a few manual steps we need to do first, so let's get started.
First of all, go to the Dialogflow console and click on the gear icon right next to your agent's name to get to the General tab. You will find a service account right beneath the project ID:
Click the service account link, it will lead us to the Google Cloud Platform, where we will create a new service account using the button at the top of the page:
Dialogflow API Admin as the role:
After creating the service account, we create a new
Last but not least move the saved key file to our project's root folder.
The Jovo CLI uses the Google Cloud SDK to access Dialogflow through projects on the Google Cloud Platform. You can download it here.
Install the SDK and initialize it using the quickstart guide from Google.
After that add both the
projectId of your Dialogflow agent and the path to the
keyFile to your project's
Now run the build and deploy command and your agent will be updated:
The result should look like this:
To be sure you may want to check the 'Validation' tab in Dialogflow.