Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Genie router plugin that enables the use of the Google Assistant for processing input.

Notifications You must be signed in to change notification settings

genie-ai/genie-router-plugin-google-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin is built on the excellent google-assistant module. It enables communication with the Google Assistent via the genie-router clients.

Its configuration consists of three steps:

  1. Configure a Google Cloud project
  2. Install the plugin
  3. Link your Google credentials

Google Cloud Configuration

Follow the instructions to create a JSON file for OAuth2 permissions.

Verify using an 'official' Assistant client (Android phone, Google Home, etc), that you can use the Assistant with your account. Google Apps accounts for example need to have it explicitly enabled.

Install plugin

At the plugin location ($HOME/.genie-router), type:

npm install --save @genie-ai/genie-router-plugin-google-assistant

Plugin configuration

googleClientSecretPath

Required. This is the file path to the .json file you create by following the instruction for the enabling of the API on Google Cloud.

tokensStorePath

Required. The filename to store the authorization tokens that link your Google account to the Cloud project client id.

locale

Optional. The locale to use. Defaults to the en-US locale.

Example

{
  "plugins": {
    "google-assistant": {
      "googleClientSecretPath": "<path to google client_secret...json",
      "tokensStorePath": "<path to store received google tokens.json>",
      "locale": "en-US"
    }
  }
}

Link your Google credentials

The assistent requires a Google account to work. Change to your plugin location folder ($HOME/.genie-router by default). Install the plugin by running:

npm install --save matueranet/genie-router-plugin-google-assistant

After installation has completed, run (still in your plugin folder):

./node_modules/.bin/google-assistant-setup

This will start the linking process of your Google account. It will output something similar to:

Attempted to automatically open the URL, but if it failed, copy/paste this in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype&response_type=code&...
Paste your code: (node:996) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3

The unhandled promise rejection can be ignored. Open the URL in your browser, login and authorize the app to use your account. Copy the code displayed, and paste it in the console and press enter. The process should continue and output: Assistant initialized. Next time you run the script it should not show the URL again, but immediately echo the Assistant initialized output.

Future improvements

  • Simplify generating an accessToken for the Google account by doing an OAuth flow from the webbrowser.

About

Genie router plugin that enables the use of the Google Assistant for processing input.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published