Echo Dot (3rd Gen) - Smart speaker with Alexa - Charcoal

Use your voice to play a song, artist, or genre through Amazon Music, Apple Music, Spotify, Pandora, and others. With compatible Echo devices in different rooms, you can fill your whole home with music.

Buy Now

Wireless Rechargeable Battery Powered WiFi Camera.

Wireless Rechargeable Battery Powered WiFi Camera is home security camera system lets you listen in and talk back through the built in speaker and microphone that work directly through your iPhone or Android Mic.

Buy Now

Dialogflow V2 REST API Communication

0
282


{{ Nikhil }}

After the updating of the Dialogflow API v1 to API v2, it seems a lot of people are facing issues while integrating the API v2.

Here I am showing communication with Dialogflow API v2, with and Angular 5+.

  1. Detecting Intent
  2. Triggering Intent

To get more overview you can visit Dialogflow detectIntent

This are the major APIs lot of users are willing to integrate.

The Request needs Headers with authorization token and body in terms to get success response.

For authorization you will be needing the access token which you need to generate,

You can use, google-oauth-jwt to get the new access token every time.

You can come with any alternative ways to get new token when token expires or you can send request to get token on every API call.

Alternative like (try/catch, setInterval)

You will be needing your Project ID which you can easily get by Dialogflow Console.

One more thing you will be needing is sessionid which will be unique for your user or browser, you can store it in sessionstorage, localstorage or cookies.

Get Started

  1. Download JSON file containing your Project Details.

2. Create one server to get authorization token.

You can host this small snippet on your server.

For now, http://localhost:4000/token will return me access token.

3. Call DF API From Frontend (angular)

Detect Intent API call,

Triggering Event API call

That’s all you need to do to interact with Dialogflow API v2.

Thanks for reading.

If you are dialogflow lover you can join us at, dialogflowcommunity



Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here