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.
Before running the samples, make sure you've followed the steps in the Before you begin section of the client library's README.
A really basic example that sends a text query to the Assistant using the
query
method and prints its response.
View the source code.
Usage: node quickstart.js
An example that shows how to open a text conversation with the Assistant, send text queries and receive text responses.
View the source code.
Usage: node text.js
An example that shows how to detect an hotword using Snowboy, open an audio conversation with the Assistant, send audio queries and receive audio responses. Note that the two hotwords ("Ok Google" and "Hey Google") were trained against my voice, so you might want to train your own hotwords from Snowboy's dashboard. The great thing is that Snowboy lets you train any keyword you want, not just "Ok Google" and "Hey Google".
View the source code.
Usage: node audio.js