Skip to content

Google Assistant

Botsquad bots can also be exposed as actions for the Google Assistant.

Installation

To use Google Assistant with a bot, you need to go through a few steps.

  1. Create a project on Actions on Google. Choose your language and country and in the next screen, do not set up a pre-defined agent but choose 'skip'.

  2. Install the gactions command-line utility on your computer, by visiting this page.

  3. In the botsquad studio, follow the instructions for the terminal commands that you have to execute.

Once this is all set up, you can now in the Google Actions console try your action in the simulator and see it interact with your code on Botsquad.

Account linking

If you want to enable account linking for your action, you need to enter your Account Linking client ID in the Google Assistant connections page in the studio.

You can find your client ID in the account linking section of the Actions console. Note that you will also need to re-submit your action, enter the terms & conditions URL and provide testing instructions for Google

Once account linking is set up, you can trigger it by sending a special google_assistant_intent input method.

For example, the following code for a google action will check whether you have linked your account, and if not, first ask you to do so. Afterwards, main gets called again but this time with all the user details filled in.

dialog main when !user.first_name do
  say "You have to create an account first in order to use this action."
  await input_method("google_assistant_intent", intent: "actions.intent.SIGN_IN")
  # ... this part of the dialog will never be reached!
end

dialog main when user.first_name do
  say "Hi #{user.first_name}, let's start!"
  # ...
end

Note that this is a simplified example, the Google Actions guidelines specify that you will have to provide a good UX for the case where anonymous users use your action, triggering account linking as the first thing in your action will most likely get it rejected.