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. Open the Botsquad studio and create a new YAML script. ("Add YAML file" in the add script dropdown menu). Name the script dialogflow.
  10. Empty the script file and paste the contents of the downloaded JSON file in the newly created YAML file.
  11. That's it, any intents will now be queried on your own Dialogflow agent instead of the default Botsquad one.