How can I use Dialogflow V2 from my client, with Webpack?
+1
@Knowledge91 Did you already figure this one out? If so, could you please share some links to more details? :)
I outsourced Dialogflow V2 to a serverless lambda function, which is reachable over an API.
I launched a Serverless AWS Lambda, which I use to make calls to Dialogflow. The Lambda can then be called over AWS API-Gateway and communicate to the client.
Do you happen to know if there's a version of dialogflow-javascript-client for v2? https://github.com/dialogflow/dialogflow-javascript-client
@Knowledge91 ,
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.
I've been trying to bundle this into Webpack, and getting a whole bunch of unresolved module errors. Agree that it's pretty poorly integrated.
I guess for now I'll stick to V1 of the API which is relatively simple to implement in comparison, but would love to hear what other way there is around this?
Greetings! Tracking this over in #16.