Botsquad 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 Botsquad 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
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
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
With the ability to write back¶
When you want to manage the utterances from out Botsquad studio, you need to create a seperate Service Account for your Dialogflow project in the Google Cloud Console using the following steps.
- Open your Dialogflow agent
- Go to settings
- Click on the project ID to open Google Cloud Console for your project
- Click on Go to project settings
- Choose Service Accounts in the left hand menu
- Click on create Service Account
- Fill in a name and description and click on Create
- Select role "Dialogflow API admin" and click Continue
- Now you can directly create a key by clicking on the button Create key
- Choose JSON and click on Create
- Your browser will download a JSON file
- Open the JSON file and copy the contents to your clipboard
- Go to botsquad platform and go to Settings -> Integrations -> Dialogflow
- Click on Configure
- Now paste your JSON from the downloaded key file
- Enable the “Let Botsquad manage…” toggle
- Press the Save button.
Now you are ready to manage your agent out of Botsquad Studio. Plus, intents will now be queried on your own Dialogflow agent, before falling back to Botsquad's default agent.
When yo are not going to manage your intent utterances in Botsquad studio, you can simply link a read only Service Account of your Dialogflow agent by follow the following steps:
- In Dialogflow, click the gear icon next to your agent's name
- In the settings form that opens, ensure that you checked the V2 API tab. If not, check it, and click Save.
- Under the Google project section, click the "+" button in the table row that says Service account, to create a service account for your agent.
- Wait for a few seconds while Google creates a new service account
- The table now refreshes and shows a link to the service account (something like email@example.com). Click the link to open the service account.
- You are now taken to the cloud console. Click the three dots next to your service account and choose Create key.
- In the following dialog, ensure the "Key type" is set to JSON and click the Create button.
- A JSON file is now downloaded to your computer.
- In the Botsquad studio, open your bot, and go to Settings → Integrations. Select Dialogflow.
- 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.
- Disable the "Let Botsquad manage..." toggle
- Press the Save button.
That's it, any intents will now be queried on your own Dialogflow agent, before falling back to Botsquad's default agent.