Skip to content

Dialogflow

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

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(dialogflow: "project.intents.greeting")

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

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

Connecting your own Dialogflow agent

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

In order to enable your own Dialogflow agent, 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 Botsquad 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. Botsquad will now do a test request to your agent to see if the JSON credentials are valid.

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