Okay this is probably a crazy question, but for some reason I can't for the life of me pass 'body' out of this nested function.
function getFacebookUserInfo(sender_psid) {
request({
"url": "https://graph.facebook.com/v2.6/" + sender_psid,
"qs": {
"fields": "first_name,last_name,profile_pic,gender",
"access_token": PAGE_ACCESS_TOKEN
}
},
function(error, response, body) {
if (error) {
console.log(error);
return;
}
return (JSON.parse(body));
});
}