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

2.0.0 • Public • Published

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

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.

Dependents (0)

Package Sidebar

Install

npm i @genie-ai/genie-router-plugin-google-assistant

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

8.05 kB

Total Files

7

Last publish

Collaborators

  • debuggingdan
  • matueranet
  • daangemist