javascript - facebook API v2.7 in node.js how to get comments and likes count -
i trying make request fetching share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid , click_count node.js server using new facebook api v2.7 .
what came out until : var likescount=0; var commentcount=0; var sharecount=0; rp(graphapireq, { json: true }) .then(res => { commentcount = res.share.comment_count; sharecount = res.share.share_count; let graph_id = res.og_object.id; let likesapireq = https://graph.facebook.com/v2.7/${graph_id}/likes?summary=true&access_token=${appid}|${appsecret}
; rp(likesapireq, { json: true }) .then(likesres => { likescount = likesres.summary.total_count; }) response.send({likescount,commentcount,sharecount}); })
so have here 2 calls : 1. fetch comments count in weird way 0 , , share count , works , using request : https://graph.facebook.com/v2.7/?id=${url}/&access_token=${appid}|${appsecret}
;
- to likes count,which in weird way 0 , had preform call using graph id coming first call ,
https://graph.facebook.com/v2.7/${graph_id}/likes?summary=true&access_token=${appid}|${appsecret}
any ideas?do need 2 calls ? why results 0?
thanks!
i think access token should not ${app_id}|${app_secret}.
you should rather use app_id , app_secret authorize in front of facebook in order receive actual access_token can further use parameter in call trying make.
Comments
Post a Comment