forked from dialogflow/dialogflow-nodejs-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_entities_request.js
60 lines (47 loc) · 1.23 KB
/
user_entities_request.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*!
* apiai
* Copyright(c) 2015 http://api.ai/
* Apache 2.0 Licensed
*/
'use strict';
// var apiai = require("../module/apiai");
var apiai = require("apiai");
var app = apiai("YOUR_ACCESS_TOKEN");
var sessionId = "Some unique sessionId for identify unique user";
var user_entities = [{
name: 'Application',
sessionId: sessionId,
extend: false,
entries: [
{
value: 'Firefox',
synonims: ['Firefox']
},
{
value: 'XCode',
synonims: ['XCode']
},
{
value: 'Sublime Text',
synonims: ['Sublime Text']
}
]
}];
var user_entities_request = app.userEntitiesRequest(user_entities);
user_entities_request.on('response', function(response) {
console.log('User entities response: ');
console.log(response);
var request = app.textRequest('Open application Firefox');
request.on('response', function(response) {
console.log('Query response: ');
console.log(response);
});
request.on('error', function(error) {
console.log(error);
});
request.end();
});
user_entities_request.on('error', function(error) {
console.log(error);
});
user_entities_request.end();