-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (28 loc) · 783 Bytes
/
Copy pathindex.js
File metadata and controls
35 lines (28 loc) · 783 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
31
32
33
34
35
var request = require('request');
var config = require('./config.json');
var talks = require('libtlks').talk;
function getUrl(talk) {
return "http://tlks.io/talk/" + talk.slug;
};
talks.getRandom(config.mongodb, function(err, docs) {
if (err) {
throw new Error(err);
}
var talk = docs[0];
console.log(talk);
var message = talk.title;
message += "\n\n" + talk.description,
message += "\n\n" + getUrl(talk);
var data = {
message: message,
link: getUrl(talk),
access_token: config.workers.facebook.key
};
request.post({
url: 'https://graph.facebook.com/v2.3/me/feed',
form: data
}, function(err, resp, body) {
console.log(err);
console.log(body);
});
});