forked from soundhound/hound-sdk-web-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode-client-text.js
34 lines (27 loc) · 871 Bytes
/
node-client-text.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
//"houndify" module contains both client-side ("HoundifyClient") and server-side ("HoundifyExpress") parts of SDK
var Houndify = require("houndify");
var path = require("path");
//parse arguments
var argv = require("minimist")(process.argv.slice(2));
//config file
var configFile = argv.config || "./config.json";
var config = require(path.join(__dirname, configFile));
//Initialize TextRequest
var textRequest = new Houndify.TextRequest({
query: argv.query || "What is the weather like?",
clientId: config.clientId,
clientKey: config.clientKey,
//REQUEST INFO JSON
//see https://houndify.com/reference/RequestInfo
requestInfo: {
UserID: "test_user",
Latitude: 37.388309,
Longitude: -121.973968,
},
onResponse: function (response, info) {
console.log(response);
},
onError: function (err, info) {
console.log(err);
},
});