Integrating With GoogleAssistant

Objective:

This document will help you set up a dialog flow agent (agents are equivalent to Alexa skills), connect the agent to a configured skill in the Voiceworx portal, connect the Google Agent to the VoiceWorx skill and use the agent via voice interaction on Google Assistant app.

How it works?

  1. Setup skill in Voiceworx.

  2. Setup Agent in Dialog Flow.

  3. Manage integrations in Assistant App (configure if app uses account linking, skill. invocation, publishing on google play store).

  4. Integrate/connect agent with the Voiceworx skill.

Set up Skill in Voiceworx

  1. Set up your skill in the Voiceworx platform. You can also import the following template and create an app using the given template. Please follow this document to create app from the given template. Note: You need to make a slight change in the publishing step

Setup Agent in DialogFlow (DF)

Google Dialogflow allows “Lifelike conversational AI state-of-art virtual agents”. VoiceWorx users can connect their apps built in VoiceWorx to agents in google assistant. After setting up the skill in VoiceWorx, users need to setup agent in Google Dialogflow. Please follow the following steps.

  1. Sign in with your Google account

  2. Click on “Create Agent”. Provide the Agent Name and Click on Create. The agent’s name cannot contain whitespaces. If you have an agent already, click on the drop down and select the agent.

  1. Create Intent. On the left menu, click on Intents. On the resulting screen, click on “Create Intent”.

  1. Provide the following details:

    1. IntentName: GetProductInfoIntent (same as the intent name in VoiceWorx)

    2. TrainingPhrase: Keyword to invoke the intent (same as utterance for the intent in VoiceWorx)

    1. Action and Parameters: For intents that contain parameter (corresponding to Slots in VoiceWorx), Provide the parameter details. The parameter name shall be same as the slot name in VoiceWorx. Provide the entity type as @sys.any. You can select from the available entity types as per your parameter type or also create custom ones.

    1. User can also set the prompt message for asking the user input for the parameter value. Click on the prompts section and provide prompt messages.

  1. Scroll down to the “Fulfilment Section” and select “Enable webhook call for this intent”.

  1. Click on Save.

  2. Now to setup for webhook, on the left-navigation, click on Fulfillment. Enable the Webhook toggle and provide the URL to VoiceWorx.

Depending upon where your app is located in VoiceWorx, provide the following URLs.

Development/ Staging: https://channeltest.voiceworx.ai/api/v1/google

Production/ Live: https://channel.voiceworx.ai/api/v1/google

  1. For testing the agent, use the try it now section.

Start with the training phrase you set up in step 6.b. i.e. find product

Provide the product name value as ‘apple watch’ after the agent asks for product name and you shall be able to get the following response.

  1. The agent has been tested successfully.

Integrations

Depending upon whether the app in VoiceWorx requires account linking or not, you can set integrations on Google DialogFlow. For the purpose of this demo, we proceed with Integration without account linking.

Integration Without Account Linking

  1. Click on Integrations menu, and then on “continue with Integrations” on the main screen.

  1. On the resulting screen, ensure that “Sign in Required” is unchecked and click on Manage Assistant App.

  1. Now to test the app, let’s link the assistant with VoiceWorx agent.

Connect Dialog Flow Agent with the Voiceworx Skill

  1. Go to the Dialog Flow page, click on the gear icon as shown in the image and copy the project id in the resulting screen.

  1. Go to the voiceworx platfrom, on the left navigation, click “Custom App” -> “Manage Apps” then hit the select button for the app you set up in the step 1. Then Click on the Publish tab.

  1. If publish profile for ‘Google Assistant ’ channel is already set up, click on Edit and update the google Project Id.

  1. Else, Add New Publish, and on the resulting dialog, make sure the Channel is set and “Google Assistant” and paste the Google Agent ID that was copied from the Dialog Flow screen to the “Google Project Id” text box

  2. Click “Save”.

Test the DialogFlow Agent

  1. On the integrations, click on “Continue with Integrations”, Click on Test on the resulting tab.

  1. You will be redirected to the Google Actions Console. On the Test tab, enter Talk to Product Lookup. “Talk to Product Lookup” shall be auto generated.

  1. Provide the training phrase set up in step 6.b. Then continue.

The successful dialog flow looks something like the screen shown above. The assistant is deriving results from its integration to the VoiceWorx App.

Integrate With Account Linking OAuth

For this step, you first need to gather the ClientId and Client Secret.

Get Credentials for Web Service:

Use the following steps below to setup your Client Id and Secret

  • Download the json for the OAuth2 Client (Web Client) into a secure place and copy the ClientId, Secret, Token URL, Auth Url from the json file.

Note: Skip this step if you have followed the Setup without account linking step above.

Setup Account Linking

  1. Click on integrations and select “Continue with Integrations” on the main screen.

  1. Select Google Assistant and click Integration Settings in the GA Card, if the skill requires account linking select the Sign-In Required Option on the Welcome Intent.

  2. Select the Manage assistant app to set up the OAuth

  3. In the Manage Assistant APP console, select Develop -> Account Linking

  4. In the Account linking screen use this options for the OAuth configuration

  • Account Creation -> Do you want to allow users to sign up for new accounts via voice? – NO

  • Linking type: OAuth, Authorization Code

  • OAuth Client Information

  • ClientId – From previous step

  • Client Secret – From previous step

  • Authorization URL- https://portal.voiceworx.ai/OAuthCode/Redirect

  • Token URL - https://portal.voiceworx.ai/OAuthCode/Token

  • Testing Instructions: Your VoiceWorx registered email.

You can now test the bot and you shall receive following output.

Publishing the Project

  1. Click on “Integrations” in the side menu and select “Continue Integrations” in the resulting modal.

  2. Click on “Manage Assistant App”

  3. In the “Quick SetUp” section, click the “Decide How Your Action Is Invoked”

  4. Set the Display name

  5. Click on deploy.

  6. Fill the following fields:

    1. Description: Short and full description

    2. Images: 2 images but only the small Logo image is compulsory. The large banner is optional. The large banner should be 1920 x 1080 px

    3. Privacy and consent: Privacy is compulsory but terms and condition url is not compulsory

    4. Contact details the developer email and name: email should be an active email

    5. Additional information: fill all fields that apply

These fields are mandatory and the information provided here should reflect the assistant and your company. Missing out these fields might cause issues while trying to release the app.

  1. Click Save

  2. Go to Company Information and fill the following fields

    1. Company Contact

    2. Developer contact

  3. Go to brand verification follow these instructions from google to verify your https://support.google.com/webmasters/answer/9008080?authuser=0&visit_id=637501983465305388-959464850&rd=1

  4. Click on Release.

  5. Select the Alpha Release tab in the resulting pane and click on “Manage Beta Testers”

  6. Type in the email address of your beta testers click on the “+” sign and click save. Note: emails should be a valid google account

  7. Click on “Save” then click on the back arrow button in front of the “Whitelist alpha testers” label to go back to the Manage Releases page

  8. On the Manage releases page, click the “Create a release” button.

  9. Note: its take between 30 minutes to 4 hrs to get a response on the release request, if there is any issue on the release request, the necessary information will be shown on this Google Actions console page.

  10. Click on the “More info” to see the details of what needs to be fixed

  11. Note: the privacy policy is a very common cause of google declining releases. It must conform to the following

    1. The URL must link to a valid website containing a privacy policy specific to your Action.

    2. It must be a public document that discloses how your Action collects, uses, and shares user data, including the types of parties it is shared with.

    3. It must be available for Google crawlers to access and scan the content of the privacy document.

    4. It must also be written in each of the languages for which your Action is enabled.

    5. It must contain any of the following:

      1. Action Name:

      2. Company Email:

      3. Developer Email:

    6. Please see https://developers.google.com/assistant/console/policies/general-policies#user_data for more information.

Test the project

  1. Launch Google Assistant on your mobile

  2. Say “Hey Google talk to product lookup”

Last updated