Skip to content
FacebookYouTubeX (Twitter)

Generate Dialogflow Google Credentials File

In this tutorial you’ll learn how to generate a Dialogflow’s Service Account Google Credentials file (.json) to use in Pingstreams chatbot integrations.

In general, this file allows you to query your Dialogflow Agent from a Client component, like a web service, a proxy and so on.

Go to your Dialogflow console and select the agent for whom you want to generate the Credentials file.

With the agent’s name shown in the top left corner, click on the ⚙︎ beside the name:

Dialogflow Settings

The “General” tab is selected. Click on the Service Account link, as shown by the arrow in the following figure:

Service Account Link

In the Service accounts section click on the top menu option + CREATE SERVICE ACCOUNT:

Create Service Account

Now choose a name for your service account (Service account name field). Service account ID is autogenerated based on name. Choose an optional Service account description if you prefer. Press “CREATE” button.

Service Account Details

In the next step you will be asked to select the role for this Service account. Press the menu pointed by the arrow in the figure (Select a role):

Select Role

A menu will open with an autocompleting text box. Type “dialogflow” and, from the listed results choose Dialogflow API Client as role:

Dialogflow API Client Role

Then press “Continue”.

In the last step, leaving all the options with their default value, press + CREATE KEY button on the Service Account form’s bottom.

Choose JSON (default option) from the right panel, then CREATE.

Create JSON Key

Now Google Cloud Console will generate your private key (your Google Credentials file) that will allow you to call Dialogflow APIs from the Pingstreams proxy (or from whatever application you want):

Download Credentials

:::warning Security Notice As highlighted in the popup you must securely save the file on your computer and never publish it online (for example never push this file on public Github repos). :::

The downloaded JSON file contains all the necessary credentials to authenticate with Dialogflow APIs. The file structure typically looks like this:

{
  "type": "service_account",
  "project_id": "your-project-id",
  "private_key_id": "key-id",
  "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
  "client_email": "service-account@your-project.iam.gserviceaccount.com",
  "client_id": "client-id",
  "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/service-account%40your-project.iam.gserviceaccount.com"
}
  • Never commit credentials to version control: Add *.json to your .gitignore
  • Use environment variables: Store the file contents in environment variables for production
  • Rotate keys regularly: Create new keys periodically and delete old ones
  • Limit permissions: Only grant the minimum necessary permissions
  • Environment Variables: Store the entire JSON content as an environment variable
  • File Storage: Store the file securely on your server with restricted access
  • Container Secrets: Use container orchestration secrets for cloud deployments

In some Pingstreams tutorials or documentation you will be asked to have this file on hand, so please refer to this tutorial to generate a new one when needed.

The credentials file enables your Pingstreams external chatbot to communicate securely with your Dialogflow agent, providing the foundation for all the advanced integration features covered in the other tutorials.

Enjoy your Pingstreams integration!