Reputation: 41
I am new to Node.js and I am having difficulties. I just wanted someone to explain where I am going wrong. I am trying to get stats from my Facebook chats and I wanted to used this API call. This is the basic code I have written.
var login = require("facebook-chat-api");
login({email: "Email", password: "Password"}, function callback (err, api) {
if(err) return console.error(err);
var threadID = chatNo;
output = api.getThreadInfo(threadNo)
console.log(output)
});
When I run this on Node.js the output is "undefined", I cant tell if its because the API call didn't work, or because I am trying to output it incorrectly. Any help would be greatly appreciated.
Output of Node.js
Upvotes: 1
Views: 95
Reputation: 13532
You should be using the callback of getThreadInfo
like this
login({email: "Email", password: "Password"}, function callback (err, api) {
if(err) return console.error(err);
var threadID = chatNo;
api.getThreadInfo(threadID, function (err, info) {
console.log(err, info);
});
});
Upvotes: 1