# Google Dialogflow
Dialogflow is a natural language understanding platform that makes it easy to design and integrate a conversational user interface into your mobile app, web application, device, bot, interactive voice response system, and so on. Using Dialogflow, you can provide new and engaging ways for users to interact with Workbot.
When Workbot is connected with Dialogflow, all commands sent to Workbot will be processed by your connected Dialogflow bot's NLP (instead of Workbot's default NLP).
# API version
The Dialogflow connector uses Dialogflow API v2.
# Workbot support for Dialogflow
Currently, Workbot for Slack supports the use of Dialogflow on Workato.
# How to connect Dialogflow on Workato
The Dialogflow connector makes use of the Client access token, obtained from the
client email and
private_key of the Google Cloud Platform Service Account that your Dialogflow agent is associated with.
In order to use the V2 API, you will need to create a new Service Account for your agent, and obtain its key. The key can be downloaded as a JSON file once you create the new Service Account. This JSON file contains both the
client email and
private_key, which are needed to connect to Dialogflow.
Workato uses the provided
client email and
private_key to exchange a client access token for use by the Dialogflow connector.
This document assumes that you already have a project and Dialogflow agent. To create a new one, check out Dialogflow's guide on creating a new project and Dialogflow agent.
# Creating a Service Account and getting the Client Access Token
In order to use the V2 API, you will first need to create a new Service Account and obtain a private key associated with that Service Account. The key can be downloaded as a JSON file once you create the new Service Account.
Caution: Your project will have an existing service account, but this should not be altered. For additional client and developer API access, you should create a new service account.
From your Dialogflow console, head to your agent's settings by clicking on the gear icon of your agent, to the right of the agent name. Dialogflow agent settings
If you wish to use another project, you’d need to create a new agent. You can easily do so from any existing project by going to the ‘Export and Import’ tab and clicking the ‘EXPORT AS ZIP’ button.
Under the GOOGLE PROJECT section, click on the name of the Service Account. Getting to the Google Cloud Platform Service Accounts page This will take you to the Google Cloud Platform Service Accounts page.
Click on the Create Service Account button at the top of the page.
In the pop up, enter your preferred details for this service account, then click Create. Creating a service account for your agent
Next, you'll need to grant this service account access to your agent so it has permissions to operate optimally. Under the Dialogflow category, filter by 'dialogflow' and select from any of the following roles.
|Role name||Access Description|
|Dialogflow API Admin||Full API access|
|Dialogflow API Client||Session-level API access|
|Dialogflow API Reader||Read-only API access|
Service account roles
Once done, click on Continue.
Create a key for this service account by clicking on the Create key button. Begin creating a key
Choose JSON as the Key type, then click the Create button. Choose JSON key type
When the key is created, a download of the JSON file will start. Choose a location (remember the path to this location, you'll need it later!) to save it and confirm.
Caution: You can only download this JSON file once, so make sure to save the file and keep it somewhere safe. If you lose this key or it becomes compromised, you can use the same process to create another.
Once complete, you'll see a pop up with a confirmation message. Click Close.
Set up the Google Cloud SDK on your machine if you don't have it already. Follow the steps described here: https://cloud.google.com/sdk/docs/ (don't worry, it's quick and easy)
After the Google Cloud SDK is up and running, execute the following command in terminal (replacing
<service-account-key-file.json>with the path to the JSON file you downloaded in step 8):
gcloud auth activate-service-account --key-file=<service-account-key-file.json>
- Next, obtain the Client Access Token by executing the following command in terminal:
gcloud auth print-access-token
- Use the Client Access token in your Dialogflow connection in Workato.