Nodejs-dialogflow: Import to Angular 6 Project

Created on 15 May 2018  路  18Comments  路  Source: googleapis/nodejs-dialogflow

Hey,
it is possible to import the npm module dialogflow-nodejs-client-v2 to an angular project? Can I also use features like the Google Cloud Speech service?

Thanks for your answer!

triage me dialogflow web

Most helpful comment

Ty @ballwood
I decided too use this package on server side. So I started to implement my own node.js Server.

The docu is really bad :(

All 18 comments

I don't know about Angular but I "guess" the answer should be yes for your first question.

I didn't get your second question, are you asking whether you can call Speech service with this client library? if so, the answer is no, Dialogflow and Cloud Speech are two different apis with different client libraries.

I successfully installed the previous version but no success so far with this one.

I don't think that it is possible, something seems wrong.
npm install --save dialogflow works fine.

Though, everything crashes when I add the following code bellow the imports of an Angular service:
const dialogflow = require('dialogflow');

image

Thank you for your answers!
@madongfly I read that you can use the Google Speech api in Dialogflow v2 for speech-to-text conversation.
@Ploppy3 I get the same errors.

You can pass the audio directly to Dialogflow for querying, Dialogflow will convert it to text.

Hi guys, what's the Dialogflow library version you used? can you find the missing .js file using ls? we are trying to reproduce it.
Thanks,

One of my teammate suggested "install nodejs lib for angular may help".

@madongfly "dialogflow": "0.4.0"
How can I install "nodejs lib" ?

@Ploppy3 nm, I misunderstood my teammate.

Are you able to find the missing .js files using ls, we tried "npm install" in an empty dir and got those files.

@madongfly
Some files seem to be missing.
image

Please note that I'm installing with yarn.

@madongfly
How should I pass it directly to Dialogflow without using the node-js client?

@roxor1909
By "directly", I meant you don't need to call Cloud-Speech-to-Text API, instead, just calling Dialogflow api (through the Dialogflow client).

@madongfly any news?

You can't integrate it directly to your angular project.
You need to write your own node.js Rest service and there you can use this package.

@roxor1909 I don't think that's how you are supposed to do it.

I didn't know any other solution.
I think the name is Client libaray because your Rest Service is the clint of Dialogflow.

@roxor1909,

You might have some luck with the implementation in googleapis as they use axios which is client side and are REST only, try this code below:

````
'use strict';

const {google} = require('googleapis');
const path = require('path');

async function runSample () {

const client = await google.auth.getClient({
keyFile: path.join(__dirname, 'key.json'),
scopes: 'https://www.googleapis.com/auth/cloud-platform'
});

const dialogflow = google.dialogflow({
version: 'v2',
auth: client
});

const result = await dialogflow.projects.getAgent({
parent: 'projects/'
});

console.log(result.data);

}

if (module === require.main) {
runSample().catch(console.error);
}

// Exports for unit testing purposes
module.exports = { runSample };
````

I've been looking for this solution for 2 weeks...really poorly documented.

Ty @ballwood
I decided too use this package on server side. So I started to implement my own node.js Server.

The docu is really bad :(

Hi All, I am developing Chatbot Mobile Application with Ionic V3 and Dialog Flow v2, please share any sample code or any example for integration of Dialog flow for text, audio, event request?

Thanks in advance.

Was this page helpful?
0 / 5 - 0 ratings