Integrating Dialogflow with babelforce is easy, however, there are a few steps you need to be doing on the Google side. This article is a step-by-step explanation.
1. Create a Dialogflow Agent
- Start by creating a new agent here: Dialogflow console
- Remember to select the default language on creation
- Very important: Either select an existing Google Project or create a new one! This is relevant for billing.
2. Enable the Dialogflow API
- To get started, go to the API Dashboard in the Google console : API Dashboard
- Select the project your agent is connected with (left hand corner, next to the Google icon)
- .Once you are in the right project, click on "Enable APIs and services" and search for "Dialogflow"
- you can also reach the page by going here: https://console.cloud.google.com/apis/library/dialogflow.googleapis.com
-
This is what you should see once the API is enabled.
3. Creating the Service Account
- Next, we will setup the Service Account
- Navigate to IAM and admin and select Service accounts
- you can also directly click here: https://console.cloud.google.com/iam-admin/serviceaccounts
- Next, click on "Create service account"
- Next, you give the account a name and confirm with "Done"
- You can also assign Permissions, like "Owner" or whatever fits your Google role concepts
4. Creating the JSON Key
- Once it's created, find the service account, click "Actions" and select "Manage Keys"
- select "Add key" > "Create new key"
- Select Key type JSON and click on "Create"
The key will automatically be downloaded to your computer or you will be asked to save it on your computer!
This is very important, you will need this file for completing the integration on the babelforce side.
Find the downloaded file and open it. It will look a bit like the code block below. The three important elements from this file are marked yellow and bold. The only difference will be that you private_key is going to be much longer:
{
"type": "service_account",
"project_id": "intenttraining-xxx",
"private_key_id": "efawefdasdfadsfafeawwfeawffasdfa",
"private_key": "-----BEGIN PRIVATE KEY-----\ndfajladsf+adfliasdfaenfl\nafsdjfladf7894n2nlq4nfef.fwefq342lifneli32\nfajdsflasdf7adf92349324032rjlieafln\n-----END PRIVATE KEY-----\n",
"client_email": "intentapi@intenttraining-xxx.iam.gserviceaccount.com",
"client_id": "12312312321321321321312321",
"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/intentapi%40intenttraining-xxx.iam.gserviceaccount.com"
}5. Formatting the private key
Before doing the bit on the babelforce side, go to this onlinen formatter: https://www.freeformatter.com/javascript-escape.html - we will have to get the private_key into a new format. We will get rid of the \n and put the whole key in a nice block.
Copy the whole key into the formatter and press unescape. The result should look something like this (just much longer):
6. Setting up the App in babelforce manager
The rest is easy.
- Go to your babelforce account
- Navigate to Automations > Apps (Integrations)
- Click the Add button at the top of the page
- Search for Dialogflow:
In your last step, fill out the form with the details from the JSON file.
- Client email = "client_email"
- Project ID = "project_id"
- Private Key = Use the formatted version we created in the step above.
Related to
Comments
0 comments
Please sign in to leave a comment.