Deploying your Dialogflow Agent using the Jovo CLI

by Kaan Kilic on Sep 10, 2018

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.


You can also watch the full process of creating a Jovo project and a Dialogflow agent, and deploying it with the CLI in this video (for the deployment part, feel free to skip to minute 12:20):


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 Language Model. Usually, you have to do one of the following in the Dialogflow Console:

  • Update the language model manually
  • Use the file created with jovo deploy to RESTORE your existing Dialogflow agent in the preferences:

Can become quite annoying, right?

Finally, you can use the command line to update your Dialogflow agent! 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.

Step 1: Updating to the Dialogflow V2 API

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 settings tab:

On the bottom of the page you can find the toggle for the V2 API. The system will ask you, if you're sure, that you want to change the API version, since the request and response format will change, but no worries, the Jovo framework can handle both the V1 and V2 API.

That's it! Now we need to set up the authentication to be able to access the Dialogflow agent programmatically.

Step 2: Setting up Authentication

After saving the changes (Dialogflow v2 API), you will find a service account right beneath the project ID:

Dialogflow Service Account

Step 2.1: Creating a new Service Account

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:

Google Cloud IAM

Google Cloud IAM New Account

We select Dialogflow API Admin as the role:

Google Cloud IAM Role

After that we create a new JSON key:

Google Cloud IAM Key

Last but not least move the key file to our project's root folder.

Step 2.2: Activating the Account with the Cloud SDK

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.

Step 3: Deploying your Agent with the Jovo CLI

After that add both the projectId of your Dialogflow agent and the path to the keyFile to your project's project.js file:

Now run the build and deploy command and your agent will be updated:

The result should look like this:

Any questions? You can reach us on Twitter or Slack.

Kaan Kilic

Technical Content Marketing Associate at Jovo

Comments and Questions

Any specific questions? Just drop them below or join the Jovo Community Forum.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.