Create an Action for Google Assistant using Watson Assistant
This repository will not be updated. The repository will be kept available in read-only mode.
This code pattern includes a Watson Assistant workspace to demonstrate an implementation of a retail agent that can ask for reservation schedules and specifics. To demonstrate how to test it with Google Assistant devices, we will setup a Google Action that calls out to our Node.js server which interacts with Watson Assistant.
When the reader has completed this code pattern, they will understand how to:
Click on one of the options below for instructions on deploying the Node.js server.
Create your project
New project
Create project
Actions SDK
cardOK
Set the invocation name
Quick setup
, click Decide how your Action is invoked
.Save
.Obtain your project ID
Project settings
.Project ID
to use later.Clone the repo
Clone the watson-google-assistant
repo locally. In a terminal, run:
git clone https://github.com/IBM/watson-google-assistant
Install the gactions
CLI
gactions
CLI from here.chmod
the gactions
file to make it executable.gactions
file into your local repo's actions
directory.
# For example, depending on your download and repo directories...
chmod +x ~/Downloads/gactions
cp ~/Downloads/gactions ~/watson-google-assistant/actions/
Edit url
in the actions/action.json
file in your local repo.
If you deployed with OpenShift, use the URL you saved at the end of the OpenShift deployment (from a TLS secure Hostname
).
If you deployed with Cloud Foundry, use your app URL.
Note: The URL must have an
https://
prefix!
Create the action using the CLI
Note: If/when it prompts you to enter an authorization code, browse to the provided URL to login and authorize the CLI to use your account and copy/paste the auth code at the prompt.
Run the gactions
command to update your action and prepare it for testing. Use the project ID you saved earlier.
cd ~/watson-google-assistant/actions/
./gactions update --action_package action.json --project <YOUR_PROJECT_ID>
./gactions test --action_package action.json --project <YOUR_PROJECT_ID>
Test it in the simulator
Test
tab and start testingInput
box or click on the microphone icon to use voice inputTry it with your phone, your Google Home, or other device
Chat and fill in the "slots" using natural language
Try some "digressions" such as:
If you want to submit the app for approval, follow Google's process documented here
If you get an error on your Cloud Foundry deployment, please see this issue. You will need to add environmental variables to your CF app, and then once you do that, the app will restart automatically and it should work as intended.
This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 and the Apache License, Version 2.