forked from shivkanthb/botlytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
61 lines (43 loc) · 1.06 KB
/
index.js
File metadata and controls
61 lines (43 loc) · 1.06 KB
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
var bot_token;
var request = require("request");
module.exports = {
incoming : function(input, conv_id, callback) {
var options = {
method: 'POST',
url: 'http://www.botlytics.co/api/v1/messages?token='+bot_token,
json: true,
body: {
message: {
text: input,
kind: "incoming",
conversation_identifier: conv_id
}
}
};
request(options, function (err, res, body) {
callback(err, res, body);
});
},
outgoing: function(output, conv_id, callback) {
var options = {
method: 'POST',
url: 'http://www.botlytics.co/api/v1/messages?token='+bot_token,
json: true,
body: {
message: {
text: output,
kind: "outgoing",
conversation_identifier: conv_id
}
}
};
request(options, function (err, res, body) {
callback(err, res, body);
});
},
setBotToken: function(token) {
bot_token=token;
}
};
// module.exports.incoming=incoming;
// module.exports.outgoing=outgoing;