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:
- Configure a Google Cloud project
- Install the plugin
- Link your Google credentials
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.
At the plugin location ($HOME/.genie-router), type:
npm install --save @genie-ai/genie-router-plugin-google-assistant
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.
Required. The filename to store the authorization tokens that link your Google account to the Cloud project client id.
Optional. The locale to use. Defaults to the en-US locale.
{
"plugins": {
"google-assistant": {
"googleClientSecretPath": "<path to google client_secret...json",
"tokensStorePath": "<path to store received google tokens.json>",
"locale": "en-US"
}
}
}
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.
- Simplify generating an accessToken for the Google account by doing an OAuth flow from the webbrowser.