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};

  1. 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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -