-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
30 lines (28 loc) · 770 Bytes
/
Copy pathexample.js
File metadata and controls
30 lines (28 loc) · 770 Bytes
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
var Talkbot = require("./");
var fs = require("fs");
//CALL A MODULE OF YOUR BOT
var options_trigger = {module:"YOUR_MODULE_ID",user:"YOUR_USER_ID",authorization_bearer:"YOUR_AUTH_BEARER_CODE"};
Talkbot.trigger(options_trigger,function(message,error){
if(error){
console.log(error);
}
if(message){
console.log(message);
}
});
//LISTEN YOUR BOT FOR A TRIGGER
var options = {
key: fs.readFileSync('/path/to/key', 'utf8'),
cert: fs.readFileSync('/path/to/cert', 'utf8'),
ca: fs.readFileSync('/path/to/cert', 'utf8')
};
var port = "YOUR_PORT_TO_LISTEN";
var options_listen = {port:port,https:true,server_options:options};
Talkbot.listen(options_listen,function(message,error){
if(error){
console.log(error);
}
if(message){
console.log(message);
}
});