Skip to content

Dialogflow

DialoX leverages the NLP engine of Google Dialogflow for matching of intents and extracting of entities based on a trained Dialogflow agent.

It can also synchronize all the intents and entities between your Dialogflow agent and your bot, so you can manage them from the DialoX studio.

Dialogflow intents in Bubblescript

You can link any intent to its DialogFlow equivalent to enable the triggering of the dialog when an intent gets classified:

@greeting intent(provider_type: "dialogflow", provider_name: "project.intents.greeting")

dialog trigger: @greeting do
  say "Hello to you too!"
  log intent
end

The message.intent.entities variable holds any entities that were matched as a result of DialogFlow's intent classification.

They are also accessible directly under message.*; e.g. if your entity is called age, you can use message.age or message.intent.entities.age.

Connecting your own Dialogflow agent

By default, DialoX's dialogflow intents are looked up in the default DialoX agent. In order to connect your own Dialogflow agent, you need to connect your agent's service account with your DialoX bot.

With the ability to write back

When you want to manage the utterances from out DialoX studio, you need to create a separate Service Account for your Dialogflow project in the Google Cloud Console using the following steps.

  1. Open your Dialogflow agent
  2. Go to settings
  3. Click on the project ID to open Google Cloud Console for your project
  4. Click on Go to project settings
  5. Choose Service Accounts in the left hand menu
  6. Click on create Service Account
  7. Fill in a name and description and click on Create
  8. Select role "Dialogflow API admin" and click Continue
  9. Now you can directly create a key by clicking on the button Create key
  10. Choose JSON and click on Create
  11. Your browser will download a JSON file
  12. Open the JSON file and copy the contents to your clipboard
  13. Go to DialoX Studio and go to Settings -> Integrations -> Dialogflow
  14. Click on Configure
  15. Now paste your JSON from the downloaded key file
  16. Enable the “Let DialoX manage…” toggle
  17. Press the Save button.

Now you are ready to manage your agent out of DialoX Studio. Plus, intents will now be queried on your own Dialogflow agent, before falling back to DialoX's default agent.

Read only

When yo are not going to manage your intent utterances in DialoX studio, you can simply link a read only Service Account of your Dialogflow agent by follow the following steps:

  1. In Dialogflow, click the gear icon next to your agent's name
  2. In the settings form that opens, ensure that you checked the V2 API tab. If not, check it, and click Save.
  3. Under the Google project section, click the "+" button in the table row that says Service account, to create a service account for your agent.
  4. Wait for a few seconds while Google creates a new service account
  5. The table now refreshes and shows a link to the service account (something like dialogflow-wftdhu@flights-36459.iam.gserviceaccount.com). Click the link to open the service account.
  6. You are now taken to the cloud console. Click the three dots next to your service account and choose Create key.
  7. In the following dialog, ensure the "Key type" is set to JSON and click the Create button.
  8. A JSON file is now downloaded to your computer.
  9. In the DialoX studio, open your bot, and go to SettingsIntegrations. Select Dialogflow.
  10. Click the blue Configure button and paste in the contents of the JSON file you just downloaded, and press Save. DialoX will now do a test request to your agent to see if the JSON credentials are valid.
  11. Disable the "Let DialoX manage..." toggle
  12. Press the Save button.

That's it, any intents will now be queried on your own Dialogflow agent, before falling back to DialoX's default agent.