Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@giwisoft/nodejs-assistant

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giwisoft/nodejs-assistant

Google Assistant SDK for Node.js

  • 0.8.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source
Google Assistant logo

Google Assistant SDK: Node.js Client

Node.js idiomatic client for Google Assistant SDK (unofficial).

The Google Assistant SDK lets you add hotword detection, voice control, natural language understanding and Google’s smarts to your devices. Your device captures an utterance (a spoken audio request, such as What's on my calendar?), sends it to the Google Assistant, and receives a spoken audio response in addition to the raw text of the utterance.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

Some configuration steps are needed to make this library work correctly, for example creating a Cloud Platform project, creating a device and generating OAuth2 credentials. Please, follow the Google Assistant Library for Python guide to get started quickly.

Installing the client library

npm install --save nodejs-assistant

Using the client library

// Imports the Google Cloud client library
const {Assistant, AssistantLanguage} = require('nodejs-assistant');

// Your credentials
const credentials = require('path-to-your-credentials.json');

// Creates a client
const assistant = new Assistant(/* required credentials */ {
  type: 'authorized_user',
  client_id: credentials.client_id,
  client_secret: credentials.client_secret,
  refresh_token: credentials.refresh_token,
}, /* additional, optional options */ {
  locale: AssistantLanguage.ITALIAN, // Defaults to AssistantLanguage.ENGLISH (en-US)
  deviceId: 'your device id',
  deviceModelId: 'your device model id',
});

// Sends a text query to the assistant
assistant.query('Hi!')
  .then(response => {
    // response contains all the fields returned by the assistant, such as the text and audio
    console.log(`Response: ${response.text}`);
    // response.audio is a Buffer containing the audio response by the assistant
  })
  .catch(err => {
    console.error('ERROR: ', err);
  });

Head over the API docs for more information.

Samples

Samples are in the samples/ directory. The samples' README.md has instructions for running the samples.

SampleSource CodeTry it
Quickstartsource codeOpen in Cloud Shell
Text Conversationsource codeOpen in Cloud Shell
Audio Conversationsource codeOpen in Cloud Shell

You might also want to check out Google Assistant Desktop (Unofficial) for a more concrete example.

Contributing

Contributions welcome! See the Contributing Guide.

License

MIT

See LICENSE

FAQs

Package last updated on 19 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc