-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
49 lines (37 loc) · 1.03 KB
/
index.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
var bot_token;
var request = require("request");
module.exports = {
incoming : function(dict, callback) {
dict.kind = "incoming";
var options = {
method: 'POST',
url: 'http://www.botlytics.co/api/v1/messages?token='+bot_token,
json: true,
body: {
message: dict
}
};
request(options, function (err, res, body) {
callback(err, res, body);
});
},
outgoing: function(dict, callback) {
dict.kind = "outgoing";
var options = {
method: 'POST',
url: 'http://www.botlytics.co/api/v1/messages?token='+bot_token,
json: true,
body: {
message: dict
}
};
request(options, function (err, res, body) {
callback(err, res, body);
});
},
setBotToken: function(token) {
bot_token=token;
}
};
// module.exports.incoming=incoming;
// module.exports.outgoing=outgoing;