GithubHelp home page GithubHelp logo

meekalabs / watson-google-assistant Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibm/watson-google-assistant

0.0 1.0 0.0 812 KB

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-google-assistant's Introduction

Build Status

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

Included components

  • Google Home: Powered by the Google Assistant, with Google Home you have command of your music, your home, and your curiosity. Start by saying, for example “Ok Google" or "Hey Google” in English.
  • Watson Assistant: Create a chatbot with a program that conducts a conversation via auditory or textual methods.

Featured technologies

  • Node.js: An open-source JavaScript run-time environment for executing server-side JavaScript code.

Watch the Video

video

Steps

  1. Deploy to IBM Cloud

  2. Setup Google Actions

  3. Talk to it!

Deploy to IBM Cloud

Deploy to IBM Cloud

  1. Press the above Deploy to IBM Cloud button, click Create+ to create an IBM Cloud API Key and then click on Deploy.

  2. In Toolchains, click on Delivery Pipeline to watch while the app is deployed.

  3. To see the app and service created and configured for this Code Pattern, use the IBM Cloud dashboard. The app is named watson-google-assistant with a unique suffix. The following service is created and easily identified by the wga- prefix:

    • wga-assistant

Setup Google Actions

  1. Go to Actions on Google Developer Console

  2. Create your project

    • Click on + Add/import project
    • Enter a project name
    • Choose the default language for your Actions
    • Select your country or region
    • Click on CREATE PROJECT
    • Click on SKIP to choose a category later
  3. Obtain your project ID

    • Next to the Overview menu item, click on the gear icon and then Project settings.
    • Save the Project ID to use later.
  4. Set the invocation name

    • Use the left sidebar menu to select SETUP > Invocation.
    • Enter a display name. Users will say or type this name to explicitly invoke your action.
    • Hit SAVE.
  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 the actions/action.json file in your local repo.

  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 left sidebar menu to select TEST > Simulator 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

Links

Learn more

  • Artificial Intelligence Code Patterns: Enjoyed this Code Pattern? Check out our other AI Code Patterns.
  • AI and Data Code Pattern Playlist: Bookmark our playlist with all of our Code Pattern videos
  • With Watson: Want to take your Watson app to the next level? Looking to utilize Watson Brand assets? Join the With Watson program to leverage exclusive brand, marketing, and tech resources to amplify and accelerate your Watson embedded commercial solution.

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

vperrinfr avatar markstur avatar kant avatar dolph avatar ljbennett62 avatar imgbot[bot] avatar

Watchers

James Cloos avatar

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.