Dialogflow — Detect intent with streaming from mic and output as streaming into speaker — Raspberrypi + Typescript

Screenshot from Raspberrypi
  1. Checkout the project from github and start using it, if you are familiar with DialogFlow.
  2. Create a GCM Project in google console.

Go to google console dashboard and create a new Project. I created a project with name `Dialogflow-Test`

Now click on the NEW PROJECT button and create a new project.

2. Generate `key.json`for the above created project

From the left side menu of dashboard page select `IAM & Admin →Service Accounts`. Now select the projected created in above steps. Click on the Create Service Account button.

Create new service account page will appear as follows. Give a name and create it.

Next step is to add Roles to the service accounts. Add 3 roles

  1. Dialogflow API Admin
  2. Dialogflow API Client
  3. Dialogflow API Reader

After selecting these 3 roles, click on continue.

Now click on the CREATE KEY button and create the key as json format. Save the key in your local machine.

Now go to your DialogFlow console and Create an Agent. I created an agent named `Room-Reservation`.

  1. Download the room-booking-agent.zip file.
  2. Click the settings button next to the agent name.
  3. Select the Export and Import tab.
  4. Select Restore From Zip and follow instructions to restore the zip file that you downloaded.

Now to the Speech tab and enable Text to Speech. Also change the voice to en-US-Wavenet-E (or some other language as your choice, but remember the decision, we need to use the name in the program later).

Now clone the repository : https://github.com/princekf/dialogflow-streaming-intent-typescript and follow the steps.

1. cd to the cloned directory
2. yarn install
3. copy the downloaded key json file into the cloned directory.
4. pass the file name as paramter while creating SessionsClient in app.ts
5. this.sessionClient = new dialogflow.v2.SessionsClient({keyFilename : './key.json'});
6. install sox using : sudo apt install sox libsox-fmt-all
7. install sound : sudo apt install libasound2-dev
8. Change project id in app.ts :
const projectId = 'dialogflow-test-101';
9. yarn dev

Now the application is started. Say hello, it will start booking a room for you.

I followed the urls :

  1. https://medium.com/google-cloud/streaming-dialogflow-on-your-desktop-device-raspberry-pi-fe95b70b33a1
  2. https://cloud.google.com/dialogflow/docs/how/detect-intent-stream
  3. https://cloud.google.com/dialogflow/docs/how/detect-intent-tts

--

--

--

Providing simple solutions for complex problems.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Fix nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl”

Detecting a User’s OS with JavaScript —  (Mobile OS Example)

Looping over arrays and objects in JavaScript

Building a Color Tool With Vanilla HTML, CSS, and JavaScript: Part Two

Amy Winehouse

Beginners Guide on How React.js Works

add SVG to WordPress

Angular[Naming convention]

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prince Francis

Prince Francis

Providing simple solutions for complex problems.

More from Medium

AngularJS End-of-Life is Here: Now What?

Lessons learned from Downsizing Mongo 3.6 by removing Shards

Version Controlling Systems & Databases

Just what the heck is Open Source?