How to use a custom Dialogflow project

On this page, you’ll learn how to:

  • Configure Dialogflow

  • Configure ZBOS to use Dialogflow

Configure Dialogflow for use in ZBOS

To allow ZBOS to use Dialogflow, a service account needs to be configured on Google Cloud. If a service account and the corresponding keys are already available, skip to configure zbos.

Create a new service account

Tap the option 'Create new service account' at the top of the page to create a new service account:

tap create service account

Enter a name to use for the service account:

service account credentials
  1. Enter a name for the service account. This will generate a unique id for the account.

  2. Optionally, enter a description for the account.

  3. Tap the button 'Create and continue' to continue setting up the service account.

Tap the role setting to view the list of available options:

service account role options

Tap the option 'Dialogflow API Admin' in the list of available options to assign the required role:

service account role

Tap the button 'Continue' in the final step to finish creating the service account. The service accounts page will be shown displaying the newly created account:

service account overview

Assign key(s) to the service account

The final step in configuring the Google Cloud to allow the ZBOS platform to use the Dialogflow project is to create the credentials for use.

Tap the option next to the service account and tap the option 'Assign keys' in the menu to create (new) keys for the service account:

service account key create json

Tap the option 'Add key' and tap the option 'Create new key' to create a new key for the service account:

service account key add

Tap the option 'JSON' in the new modal and tap the button 'Create' to create the new keys:

service account key create json

This will download a JSON file containing the required keys and credentials for use in the ZBOS configuration.

For example:

{
  "type": "service_account",
  "project_id": "your_project",
  "private_key_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "private_key": "-----BEGIN PRIVATE KEY-----\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naa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aaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaa\n-----END PRIVATE KEY-----",
  "client_email": "your-service-account@your_project.iam.gserviceaccount.com",
  "client_id": "111111111111111111111",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account%40your_project.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}
These credentials are fictitious and should not be used.

Configure ZBOS to use Dialogflow

See the chapter assign keys for more information on creating a key containing the required information for the ZBOS configuration.

Open the ZBOS Control app or website, connect to the device to use Dialogflow and open the Apps & Config page. Next, tap the option 'Robot' followed by 'Settings':

tap robot

Scroll down the list to the 'Advanced settings' in the 'Speech' section:

zbos select google profile
  1. Tap the option 'Advanced settings' to view the additional options.

  2. Tap the option 'Dialog profile' and select the option 'Google' to use the Google Dialogflow.

Additional options will be shown once the Google profile has been selected. Enter the credentials as retrieved from the JSON for the service account as shown:

zbos google details
The private key needs to have the '\n' characters replaced by line breaks. The website https://www.freeformatter.com/json-escape.html can be used for this (for example).

The entry for the example JSON shown earlier shows the following:

zbos dummy profile