dialogflow / dialogflow-nodejs-client Goto Github PK
View Code? Open in Web Editor NEWNode.js SDK for Dialogflow
License: Apache License 2.0
Node.js SDK for Dialogflow
License: Apache License 2.0
hi
i am facing trouble in saving intent. Although i created entities properly and after creating parameter values and speech response it says "Some values in parameters are unresolved:$hotelName".
$hotelName is value for corresponding parameter hotelName and entity @$hotelName.
The bot only responds to default bot_channel it created, but once you add it to custom channel created by user, it doesn't do anything.
Seems like it needs to handle ('channelAdded') event with subsequent channel.join() to make it happen?
Would be great to have this functionality by default, without requiring custom server.
The examples served well for me but when I am using domains for example News
, I am not getting any responses. No fulfilment. How to use domains? Anything explicit?
Thanks!
I cloned repo and I can't find the /module/exceptions.js file. I cannot find that file in repo browser on here too. But the file is there if I install library with npm install (ver 3.0.1)
I'm not a github nor nodejs expert here, any hint, how do I get that file via git?
Content of the file is below:
/*!
* apiai
* Copyright(c) 2015 http://api.ai/
* Apache 2.0 Licensed
*/
'use strict';
var util = require('util');
exports.ServerError = module.exports.ServerError = ServerError;
util.inherits(ServerError, Error);
function ServerError (statusCode, responseBody, message) {
var self = this;
Error.captureStackTrace(this, ServerError);
self.statusCode = statusCode;
self.responseBody = responseBody;
this.name = this.constructor.name;
this.message = message;
ServerError.super_.apply(this, []);
}
Thanks
Why does api.ai does not register intent when I ask a question via my node app (FB-messengerbot)? If I ask the same question via the agent on the website it does register the intent.
the module supports DELETE /contexts, which deletes all contexts from the specified session
But is doesn't support DELETE /contexts/{context_name} which deletes the specified context from the specified session
https://docs.api.ai/docs/contexts#delete-contextscontext_name
I am going to carve out some time to submit a PR for this
Hi There,
Right now api-ai-node-js client supports Query and User Entities API but does not support Context API. Any reason this is not supported?
Thanks
It's not implemented.
Just completed my app but when it comes to running it on a local server, I am getting an error "Client was not configured properly". But I don't see this error when I use CORS plugin on my chrome. This is the stack trace :
Fetch API cannot load https://api.api.ai/v1/query?v=20150910. Request header field api-request-source is not allowed by Access-Control-Allow-Headers in preflight response.
Please help me resolve this. Its all going good for development but when it comes to deploying, I am stuck.
i am receiving warning in api.ai "IMPORTANT: Please use unique session ID for each client. Otherwise you may experience unstable behaviour"
what i need to do?
Hi i have developed some bot, when i am calling from api.ai site it is working fine. But if i call it from node SDK it is not working incase of intents having fulfillments. i am getting default response for the same request.
i am planning to develop intelligent chatbot what are the requirements are required to develop chatbot.
1.Front end which language i need to use and back end which one i need to use.
2.any inbuilt temp lets are available?if it is not available please specify if any???
3.which operating System is best to build Chatbots Windows or ubuntu or MacOS.
4.How to start to build chatbot??? Please specify????
Can anyone post a demo application with video and code explain. Please help me out .
mail id: [email protected]
got an error like this : "Error: connect ETIMEDOUT : *.:443"
seems got blocked by the gfw in china
responseBody: '{\n "id": "fd0d8064-e7f1-49e8-be8f-acf49bd450ae",\n "timestamp": "2016-11-16T19:44:02.09Z",\n "status": {\n "code": 400,\n "errorType": "bad_request",\n "errorDetails": "Required \u0027sessionId\u0027 parameter is empty."\n }\n}',
I had tried to run "voice_request.js" example, but error has occurred like this.
ServerError : Wrong response status Code, statuesCode 502
The server encountered a temporary error and could not complete yout request Please try again in 30 seconds.
It seems that apiai server's speech recognition function isn't working now.
How could I solve this situation?
The variable code
at line 37 is not defined (ReferenceError: code is not defined
).
I think that it should have been 403 or 404 (since server accepts only POST requests and rejects everything else).
Hi, would you be able to provide more info on 'uniqueSessionIDs' ? How do I find them if I am building an independent web-application?
With typescript version 2.1.6:
node_modules/apiai/index.d.ts(25,5): error TS2666: Exports and export assignments are not permitted in module augmentations.
when I use the node library, the responses don't have any parameters, ie identified entities.
when I use the preview test console, or the copied curl query, the parameters do appear.
Is there some limitation to how the nodeSDK uses the text query? It seems somehow missing a lot of data in the response.
https://discuss.api.ai/t/parameters-dont-come-back-in-response/4815
Code:
var apiai = require('apiai');
var app = apiai("Client access token");
var request = app.textRequest('help', {
sessionId: 'unique-sesssion-id'
});
request.on('response', function(response) {
console.log(response);
});
request.on('error', function(error) {
console.log(error);
});
request.end();
Response:
{ Error: connect ECONNREFUSED 54.192.188.124:443
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '54.192.188.124',
port: 443 }
Access token : Client access token.
session-id : Some random value.
When i tried the same code in cloud9 ide , its able to fetch the exact response.
Is this error had to do something with the proxy setting?
i am not sure what mistake i am doing. i need help in figuring out this connection issue.
Hi there,
The API seems to block requests with the following message: "Request header field api-request-source is not allowed by Access-Control-Allow-Headers"
I saw that in the code here:
https://github.com/api-ai/apiai-nodejs-client/blob/master/module/request.js
on line 55 where the header is set up, the api-request-source header is added:
'api-request-source': self.requestSource
but in the documentation here: https://api.ai/docs/reference/agent/query#post_query
That header isn't there. After removing it from the code of the Node.js SDK, the request worked perfectly.
Should this be removed?
Best,
Jan
sys.unit-currency
is failing our requests as it is no longer returning the expected value and formatted currency.
Previously, when a user said: 10 dollars, 10 euros, 10 dollar
the output was in the format:
parameters.unit-currency.amount: 10
parameters.unit-currency.currency: USD
for dollars
parameters.unit-currency.currency: EUR
for euros
Today I am noticing that the output is the plain text that the user says:
parameters.unit-currency: 10 dollars
The timezone of the application never seemed to be set, and request.js is using it.
Is there a way we can set the timezone for a request?
As the code for session IDs is creating the new session everytime.
The follow up intents are not working with this code.
Also the uuid.v4 is not working for follow up intents. v1 is working.
API.AI team, please correct and take the session IDs outside the constructor, I have done it and this way the follow up intents are working correctly
The readme file has a link to the examples, but the link is invalid. It should link to:
https://github.com/api-ai/apiai-nodejs-client/tree/master/samples
not
https://github.com/api-ai/apiai-nodejs-client/blob/master/examples
Repository in question: /samples/twilio/ip-messaging/
Seems like the token lives only 60 minutes or so, so we need to request it every hour. Calling src/twiliobot.js :: start() manually every 60 minutes eliminates the problem.
It should be exposed the request properties to set the proxy
Hi guys,
any /tts endpoint support planned?
Thank
Looks like something's amuck with the official documentation for POST /v1/userEntities versus what POST /v1/userEntities is actually accepting, and I believe was previously documented as.
I've been posting to the /userEntities endpoint just fine using v3.0.3 for for quite sometime. "Upgrading" to v4.0.0 breaks this method. (This module should also include tests and much better and more complete documentation.) The author redefines the structure that's accepted to the documentation but returns as a bad request. Looks like some kind of botched endpoint version migration happening here.
Previously documented and currently accepted JSON by the /userEntries endpoint:
{
"sessionId":"12345",
"name":"city",
"extend":false,
"entries":[
{
"value":"New York",
"synonyms":[
"New York",
"Big Apple"
]
}
]
}
Newly documented and currently unaccepted JSON by the /userEntries endpoint see example:
{
sessionId: sessionId,
entities: [{
name: 'Application',
sessionId: sessionId,
extend: false,
entries: [
{
value: 'Firefox',
synonyms: ['Firefox']
},
{
value: 'XCode',
synonyms: ['XCode']
},
{
value: 'Sublime Text',
synonyms: ['Sublime Text']
}
]
}]
};
Having to return to V3.0.3 until this is resolved. Thanks.
do you plan to include TypeScript Typings for this project?
if no, would you merge a typings pull request if someone provided one (like me)?
Around https://github.com/api-ai/api-ai-node-js/blob/master/module/request.js#L41 there is a try/catch block around the processing of the response from the server, if it fails then the error callback is called.
This has just caused me a bunch of problems in that I had an error in my response handling code which gets silently consumed and then my error callback code runs - I'd consider that the request.on('error', function(error) {}); function should only be called when the server has returned an error - its not designed to handle errors in our own response code - we should do that, and with your try/catch eating them they show up in a very odd way.
Would suggest removing that try/catch and letting user supplied code handle it's own errors when dealing with the response.
https://github.com/api-ai/api-ai-node-js/blob/master/examples/text_request_with_entities.js
{ Error
at IncomingMessage. (/bot/playgroud/node_modules/apiai/module/request.js:60:29)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
statusCode: 400,
responseBody: '{\n "id": "b47b02a24----ab6",\n "timestamp": "2017-01-23T12:34:13.652Z",\n "status": {\n "co
de": 400,\n "errorType": "bad_request",\n "errorDetails": "Required 'sessionId' parameter is empty."\n }\n}',
name: 'ServerError',
message: 'Wrong response status code.' }
I'm really having problems firing a node.js webhook action from my api.ai bot. can anyone point me at the simplest possible example of a node webhook that just echoes the user entry so I can go from there ? appreciate it.
I see that the documentation has not mentioned anything about using the /entities endpoint. Can you kindly clarify how I can add/udpate/delete custom entities
The JavaScript SDK allows for streaming directly from mic. Is that capability available for Node client? Any sample/doc for a similar scenario would help.
Is this true
when trying to run the fllowing sample a get an error.
`var fs = require("fs");
// var apiai = require("../module/apiai");
var apiai = require("apiai");
var app = apiai("token", {
language: 'eng'
});
var request = app.voiceRequest();
request.on('response', function(response) {
console.log(response);
});
request.on('error', function(error) {
console.log(error);
});
fs.readFile("1.wav", function(error, buffer) {
if (error) {
console.log(error);
} else {
request.write(buffer);
}
request.end();
});`
I am working on a voice assistant that is location aware and I want to be able to fill the location slot with the initial request. Say something like "bot, turn the lights off" which would trigger an intent with a location slot. I tried sending it in context but that doesn't seem to fill the slot?
What is passed into the contexts
parameter when calling contextsRequest
?
I want to get back all the current contexts for a session
Wisdom is working on api-ai dashboard. see below image
http://prntscr.com/cnptu0
I have integrated the api-ai in my node app (Free version)
but its not working in there
here is the response I am getting.
{
"id":"0d113e16-e69b-417b-9f69-d34dd9f594c9",
"timestamp":"2016-09-29T10:38:19.87Z",
"result":{
"source":"agent",
"resolvedQuery":"Who was Albert Einstein?",
"contexts":[
],
"metadata":{
},
"fulfillment":{
"speech":""
},
"score":0
},
"status":{
"code":200,
"errorType":"success"
}
"sessionId":"00000000-0000-0000-0000-000000000000"
}
please guide me on this issue. What I am missing
You've only documented the textRequest function... but clearly if I read your source you have implemented much much more.
Hi,
PFB my issue when trying to execute from corporate proxy. Need sugessions
"Unable to get local issuer certificate when trying from corporate proxy".
Can you please tell me what needs to be done to come over this.
Regards,
Venki
/// <reference types="typescript" />
/// <reference types="node" />
you should remove that as this is not scope of package but of the environment and makes no sense + leads to unnecessary compile errors...
Hi ,
I have created several Intents but for some of them when i am using the NodeJS SDK the response is coming on error inside the below code with the error as ServerError: Wrong response status code.
request.on('error', function(error) {
console.log(error);
});
This works find from the api.ai test console. Please advise
If you try to run npm install apiai you will get the following:
npm install apiai
npm WARN package.json [email protected] license should be a valid SPDX license expression
npm WARN install Refusing to install apiai as a dependency of itself
The name in package.json conflicts with the package "apiai". A simple change to something like "api-ai-node-js" will fix the problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.