GithubHelp home page GithubHelp logo

ibm / watson-google-assistant Goto Github PK

View Code? Open in Web Editor NEW
47.0 18.0 55.0 2.56 MB

Create an Action for Google Assistant using Watson Assistant

Home Page: https://developer.ibm.com/patterns/create-an-agent-for-rental-car-reservations/

License: Apache License 2.0

JavaScript 100.00%
watson-conversation google-home google-assistant watson-assistant ibm-cloud ibm-watson

watson-google-assistant's Introduction

WARNING: This repository is no longer maintained ⚠️

This repository will not be updated. The repository will be kept available in read-only mode.

Create an Action for Google Assistant using Watson Assistant

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:

  • Create a Google Assistant Action
  • Create a Node.js Express web application
  • Deploy the Node.js app with Red Hat OpenShift or Cloud Foundry on IBM Cloud
  • Interact with Google Assistant and Watson Assistant
  • Use the conversation token to maintain the context
  • Leverage the content catalog for general, customer care, and bot control intents
  • Handle digressions during a conversation

architecture

Flow

  1. User talks or types to Google Assistant.
  2. Google Assistant posts text to an HTTPS endpoint.
  3. Node.js server calls Watson Assistant to get the response.
  4. The response is returned to Google Assistant.
  5. Google Assistant replies to the user.

Watch the Video

video

Steps

  1. Deploy the server

  2. Setup Google Actions

  3. Talk to it!

Deploy the server

Click on one of the options below for instructions on deploying the Node.js server.

openshift public

Setup Google Actions

  1. Go to Actions on Google Developer Console

  2. Create your project

    • Click on New project
    • Enter a project name
    • Choose the default language for your Actions
    • Select your country or region
    • Click on Create project
    • Click on the Actions SDK card
    • Click OK
  3. Set the invocation name

    • Under Quick setup, click Decide how your Action is invoked.
    • Enter a display name. Users will say or type this name to explicitly invoke your action.
    • Hit Save.
  4. Obtain your project ID

    • Click on the vertical 3 dots next to your account avatar and go to Project settings.
    • Save the Project ID to use later.
  5. Clone the repo

    Clone the watson-google-assistant repo locally. In a terminal, run:

    git clone https://github.com/IBM/watson-google-assistant
  6. Install the gactions CLI

    • Download the gactions CLI from here.
    • chmod the gactions file to make it executable.
    • Copy the 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/
  7. 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!

  8. 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>

Talk to it!

  1. Test it in the simulator

    • Go back to your Actions on Google Developer Console
    • Use the Test tab and start testing
    • Type in the Input box or click on the microphone icon to use voice input
    • Say "Talk to my test app" or "Talk to <your app name>" to initiate the conversation
  2. Try it with your phone, your Google Home, or other device

    • Log into the device with the same account you used to create your test app
    • Say "Hey Google, talk to <your app name>"
    • Alternatively, test the implicit invocation with "Hey Google, get me some wheels" or "Hey Google, rent a car"
  3. Chat and fill in the "slots" using natural language

  4. Try some "digressions" such as:

    • Positive or negative feedback
    • Ask to talk to the manager
    • Are you a human?
    • Do you know any jokes?
    • Store hours
    • Store locations
  5. If you want to submit the app for approval, follow Google's process documented here

Sample output

Testing with the simulator

Web Simulator

Troubleshooting

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.

License

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.

Apache License FAQ

watson-google-assistant's People

Contributors

dependabot[bot] avatar dolph avatar horeaporutiu avatar imgbot[bot] avatar kant avatar ljbennett62 avatar markstur avatar rhagarty avatar vperrinfr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

watson-google-assistant's Issues

actions sdk is deprecated

any idea if will still be possible to pass main intent to a webhook with the new version of google actions?

Thank you.

Deploy to Cloud foundry error

When I click on deploy on Cloud Foundry a toolchain gets created, however after a successful build and deployment stages, the app isn't running showing the following errors below:

The app failed to initialize properly. Setup and restart needed. Error: Error. Unable to list workspaces for Assistant: Forbidden: Access is denied due to invalid credentials.

message: 'Access is denied due to invalid credentials.',

body: '{"code":403,"error":"Forbidden"}',

connection problems

hi, my case is that you can do all the steps including the toolchain and the gactions but for some reason, you cannot connect with google assistand saying that the bot cannot answer at the moment I don't know if it is due to the update of the IBM cloud or if I did a wrong step even if it tells me that everything is in order
opñlokiyjuthr

Sending multiple responses at a time

Hi,

I want to send multiple responses to the user at a time using google assistant via watson assistant. Can you please guide me through this?

Thanks in advance

Just a word of caution for Lite Account users outside US ...

Users with a Lite account outside US may face the following issues while deploying the app with the devops Button to IBM Cloud :

  • With Lite accounts, the Cloud Foundry Org does not allow to create Spaces in other regions than your default region

  • You cannot create more than one Lite 'Watson Assistant service' for an account (so it fails if you have one already)

  • The deploy tries to create a Lite Watson instance service in US-East (which may not be offered as an option)

  • The code still refers to service userid and password and not apikey and talk of workspaces not assistant/skills ( You can use the Assistant Workspace Management Node to list all your workspaces and workspace IDs )

  • So you may have to adapt the credentials in the projet and do a deploy of your own

  • Anyway thanks for the code !

Integration of own skill with google assistant.

Hi,

This code pattern worked well for me. Now when I built my own bot using watson assistant and try to integrate with google assistant, the response while testing in the simulator says '(display name) isn't responding right now. Try again soon'. I've exported JSON from the watson skills and also changed the URL to "https://gateway-lon.watsonplatform.net/assistant/api" (as created for my assistant) in actions.json. The gactions update and test commands didn't show any error.

What am I missing? Please help!

Best,

how to end the conversions?

thank you for the respo,
I was just testing a new action using Watson but unfortunately, when I need to end the conversation using words like 'cancel', 'exit'... etc., it's not working .. since I'm a fresher I don't know how to solve this. I had trained it in Watson assistant, but it is not yet working in google assistant.

thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.