Combining multiple facebook page reviews feeds in one call - facebook

How is it possible that I can add another access token to this call that references the second id I would like to retrieve reviews from.
In all other instances like posts, photos etc this would work but because you are required to have a page access token to retrieve the data for reviews I'm not sure how to construct the url to make the call. Is it possible?
https://graph.facebook.com/ratings?ids=slickremix,reformavi&field=rating&limit=5&access_token=EAAP9hArvboQBAN5...
That call returns something like this, as you can see the second id reformavi is not returning data.
{
"slickremix": {
"data": [
{
"created_time": "2016-10-13T09:22:02+0000",
"reviewer": {
"name": "Jens Kranen",
"id": "10211267740634296"
},
"rating": 5,
"review_text": "Fantastic customer support. Very quick response. Spencer could identify the problem within minutes and gave great advice.\nThank you"
},
{
"created_time": "2016-10-07T14:22:19+0000",
"reviewer": {
"name": "Marc McHale",
"id": "10157614348555341"
}
"rating": 5,
"review_text": "I purchased the Facebook Reviews plugin for a client website and both my client and I are very happy with the appearance and functionality! Plus, the customer service was outstanding!"
}
],
"paging": {
"cursors": {
"before": "MTM4MjkwMTM4ODoxMTg3OTA3NTE1MjU4ODQZD",
"after": "MTI1MTQ3Njk2NToxMTg3OTA3NTE1MjU4ODQZD"
},
"next": "https://graph.facebook.com/v2.7/118790751525884/ratings?access_token=EAAP9hArvboQBAN5HpnbA5m87qC7poAAqB0YS47zxBCBmCfVRcqCC7zX1XDNCv6cSe3KFnMtPVysUms0MuXLxWfv8D9McMwzvD2HWWd0IO6FOZC6ogvcta8FWZBR0vUA9HCZAdqdB53fyUB26XLb76ORLspiPg3Hzb4Pn5RTjwZDZD&pretty=1&limit=5&after=MTI1MTQ3Njk2NToxMTg3OTA3NTE1MjU4ODQZD"
}
},
"reformavi": {
"data": [
]
}
}

Related

Facebook Graph API Comments not returning

I am trying to get the comments on ratings from the Facebook API.
First I request a list of ratings for a page I own:
https://graph.facebook.com/v3.0/me/ratings?fields=open_graph_story?access_token=[access_token]
Response:
{
"data": [
{
"open_graph_story": {
"message": "The best place in the world(s), and this is to reach that limit in the facebook review.",
"start_time": "2018-05-24T22:56:23+0000",
"type": "pages.rates",
"data": {
"rating": {
"value": 5,
"scale": 5
},
"review_text": "The best place in the world(s), and this is to reach that limit in the facebook review.",
"is_hidden": false,
"language": "en"
},
"id": "1805660589743235"
}
},
{
"open_graph_story": {
"message": "Very good, not excellent though. Does Facebook change the created time if I edit this?",
"start_time": "2018-04-12T20:25:26+0000",
"type": "pages.rates",
"data": {
"rating": {
"value": 3,
"scale": 5
},
"review_text": "Very good, not excellent though. Does Facebook change the created time if I edit this?",
"is_hidden": false,
"language": "en"
},
"id": "106674383523012"
}
}
],
"paging": {
"cursors": {
"before": "MTAwMDA4OTc5MzQ4Mjc3Ojc3MzQwNTI3NjIwMTQyNAZDZD",
"after": "MTAwMDI1NDEzNTE3NzgxOjc3MzQwNTI3NjIwMTQyNAZDZD"
}
}
}
(I removed some superfluous fields)
Then I use the id from the open_graph_story to get the comments for a rating:
https://graph.facebook.com/v3.0/106674383523012/comments?access_token=[access_token]
Response:
{
"data": [
],
"paging": {
"cursors": {
"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANVFF5T1RNeU1UUTVPRGszTWpNMU9qRTFNalkwT0RZAeE1qZAz0ZD",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANVFE0TlRBM09URXlOamN5T1RreU9qRTFNamN5TURJek56ST0ZD"
}
}
}
It returns no data even though I can see comments on the actual rating when I visit the Facebook page. Why are no comments returned?
(Just to make sure that I had the correct permissions, I selected all the permissions possible in the graph api explorer.)

Get comments from facebook ads (marketing)

After I make an ads for my post on facebook ads manager.
Facebook Ads Manager show me how many comment belong to this ads. This is very important for me to verify the effective of my campaign.
In programing aspect: Is there's any way to count number belong to my ads like Facebook Ads Manager (I describe above). I have used both Java Facebook Ads SDK (Ads Insight module from https://github.com/facebook/facebook-java-ads-sdk) and Graph Explorer Tool, they both return "comment" field or "like" field not existed
Please help!
You can't get comments nor reactions from Marketing Insights directly.
I stand corrected. If you have access to an ad_account insights, then you can use Marketing API to get a post's comments directly. Thanks #lamxung55
Let's say you have and ad_id of 123000000
If you have a token with ads_management or ads_read permission, you can make a request to the Marketing API such as
/123000000?fields=creative.fields(effective_object_story_id),insights.fields(actions)
This will give you the effective_object_story_id which is the object_id of the post ({page_id}_{post_id}), and its insights including its actions broken down by action type. For example:
{
"creative": {
"effective_object_story_id": "456000000_789000000",
"id": "123000000"
},
"insights": {
"data": [
{
"actions": [
{
"action_type": "comment",
"value": "12"
},
{
"action_type": "like",
"value": "2"
},
{
"action_type": "post",
"value": "3"
},
{
"action_type": "post_reaction",
"value": "29"
},
{
"action_type": "video_view",
"value": "558"
},
{
"action_type": "page_engagement",
"value": "604"
},
{
"action_type": "post_engagement",
"value": "602"
}
],
"date_start": "2017-08-14",
"date_stop": "2017-08-20"
}
],
"paging": {
"cursors": {
"before": "xxx",
"after": "xxx"
}
}
}
}
The effective_object_story_id (so, post_id) is 456000000_789000000.
You can then query the comments edge of the post adding summary=true as a parameter. This endpoint is public for common posts (however, it won't work for non public posts)
/456000000_789000000/comments?summary=true
Which will respond with an object like
{
"data": [
<LOTS OF COMMENTS HERE>
],
"paging": {
<PAGING LINKS>
},
"summary": {
"order": "chronological",
"total_count": 50,
"can_comment": true
}
}
This means the post has had 50 comments, of which 12 were made through a paid action.
We can simply use this syntax to get adset comment: ...adset_id/insights?fields=actions. Another ads stuffs are the same

page-id/notifications returns an empty array

I'm writing a desktop application using Facebook SDK .NET. This app must do somethink for every post, comment or message sent to a Facebook page. I'm using the page-id/notifications API command:
page-id/notifications?fields=id,title,unread,application,from,message,object&limit=250
This command returns correct unseen count in summary section but data array is empty:
{
"data": [
],
"summary": {
"unseen_count": 2,
"updated_time": "2016-02-05T14:53:10+0000"
}
}
If someone write a new wall post on the page or send a private message to the page, unseen_count is updated but data array is always empty. If someoune write a comment to an exisiting wall post unseen_count is updates and data array is populated with a comment notification (only this type of notification are added to data array):
{
"data": [
{
"id": "notif_XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXX",
"title": "yyyyy yyyyyyy commented on his post.",
"unread": 1,
"application": {
"link": "https://www.facebook.com/games/?app_id=xxxxxxxxxxx",
"name": "Feed Comments",
"id": "1967xxxxxxx"
},
"from": {
"name": "Mxxxx Sxxxxxx",
"id": "1020xxxxxxxxxxxxx"
},
"object": {
"created_time": "2016-02-05T14:52:32+0000",
"message": "ABCDEFGHILMNOPQRSTUVZ",
"id": "36xxxxxxxxxxxx0_546xxxxxxxxxxx0"
},
"to": {
"name": "Ixxxxxxx",
"id": "36xxxxxxxxxxxxx"
}
}
],
"paging": {
"previous": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"next": "xxxxxxxxxxxxxxxxxxxx
},
"summary": {
"unseen_count": 3,
"updated_time": "2016-02-05T14:55:23+0000"
}
}
Is it an API bug or there is something wrong in my API request?
I CANNOT use real time notification.
Thanks
Marco

Getting Likes count of each posts on a fan page in Facebook

How do I get the 'like' count of a post on Facebook?
I got a link graph.facebook.com/userid_postid that says says I can do this. But How do I find the user or page ID and the ID of the post?
For example, if take any post on the fan page:
http://www.facebook.com/TipsLearnings of site http://adityabajaj.com
If I make a post on the fan page above, and people like the post, how would I get the number of likes of that post? I want to have that number available to show on a separate website.
You can use FQL
SELECT like_info.like_count, share_info.share_count, comment_info.comment_count FROM stream WHERE post_id = 'your_post_id'
You can get a list of most recent posts a fan page made by using /<PAGE_ID>/posts (which you can find for your page by navigating to http://graph.facebook.com/myown.easytipsandtricks, or just use the username) with a valid access token. From that, you get an object that looks like this:
"data": [
{
"id": "22092443056_115909438544849",
"from": {
"name": "Starbucks",
"category": "Food/beverages",
"id": "22092443056"
},
// ...
"shares": {
"count": 708
},
"likes": {
"data": [
{
"name": "Shanna Gonzales",
"id": "100000244536406"
}
],
"count": 17129
},
"comments": {
"count": 759
}
}
// ... and more posts
Accessing the count subfield of each of those fields should tell you shares, likes and comments, respectively.
You can get the comments/likes count without having to paginate by using the fields parameter in combination with likes.limit(1).summary(true). For example, a search api query for pizza below will give you all public posts and their likes count summarized:
https://graph.facebook.com/search?q=pizza&type=post&fields=id,name,likes.limit(1).summary(true)
results (truncated):
{
"data": [
{
"id": "47883936273_659693910762305",
"name": "Instagram",
"created_time": "2014-02-16T01:15:29+0000",
"likes": {
"data": [
{
"id": "100002243084532",
"name": "Yvette Martin"
}
],
"paging": {
"cursors": {
"after": "MTAwMDAyMjQzMDg0NTMy",
"before": "MTAwMDAyMjQzMDg0NTMy"
},
"next": "https://graph.facebook.com/47883936273_659693910762305/likes?limit=1&summary=1&after=MTAwMDAyMjQzMDg0NTMy"
},
"summary": {
"total_count": 13682
}
}
},
{
"id": "136336876521150_314001148754721",
"name": "Pizza Box Turns into Plates & Storage Unit!",
"created_time": "2014-02-15T21:20:00+0000",
"likes": {
"data": [
{
"id": "100005373008864",
"name": "Liliana Campoli"
}
],
"paging": {
"cursors": {
"after": "MTAwMDA1MzczMDA4ODY0",
"before": "MTAwMDA1MzczMDA4ODY0"
},
"next": "https://graph.facebook.com/136336876521150_314001148754721/likes?limit=1&summary=1&after=MTAwMDA1MzczMDA4ODY0"
},
"summary": {
"total_count": 2792
}
}
}

Facebook Graph API - Get like count on page/group photos

I've been testing graph API and ran into a problem. How can I get like count from photos of a page/group?
I'm administrator/creator of a group. When entering in https://developers.facebook.com/tools/explorer/ certain photo ID from that group it brings almost all data, even comments, but not the like count. For like part it needs (according to docs) access token despite the fact that anyone can access that info.
How to get access token of my page/group with required permissions and how to use it to get info I need?
If possible I would like to get JSON from a single address if it is possible.
This is possible with a page (even without an access token!) and here's how:
Visit the page on the graph
Get the page's id by going to the page's url:
https://www.facebook.com/pages/platform/19292868552
The number on the end of the URL is the page's id. Take that id and use it with the graph explorer (here) or just visit it directly.
Visit the page's albums
Now appending albums to that url will give you all the albums the page has, including wall photos:
https://graph.facebook.com/19292868552/albums
The output looks like this:
{
"data": [
{
"id": "10150160810478553",
"from": {
"name": "Facebook Platform",
"category": "Product/service",
"id": "19292868552"
},
"name": "Bringing Operation Developer Love to Europe",
"description": "Blog post: http://developers.facebook.com/blog/post/479\n\nVideos and presentations uploaded here: http://developers.facebook.com/videos/",
"location": "Berlin, Paris, London",
"link": "https://www.facebook.com/album.php?fbid=10150160810478553&id=19292868552&aid=285301",
"cover_photo": "10150160811078553",
"count": 32,
"type": "normal",
"created_time": "2011-04-06T23:05:44+0000",
"updated_time": "2011-04-06T23:33:20+0000",
"comments": {
..... etc ....
Selecting an album
For each object in the data array there is an id and a name. Using these two fields you can select the album that contains the photos you want. The first album in this result is "Bringing Operation Developer Love to Europe". Lets look at this albums photos.
Seeing Photos
If you've followed the answer up to this point the next step should be fairly obvious. Use the id for the album you want and append photos to the graph url:
https://graph.facebook.com/10150160810478553/photos
Seeing a Photo's likes
Much like selecting an album, simply use an id in the output of the above step and append likes to the url to see a photos likes:
https://graph.facebook.com/10150160813853553/likes
Output:
{
"data": [
{
"id": "1163036945",
"name": "Aditya Pn"
},
{
"id": "1555885347",
"name": "Nadin M\u00f6ller"
},
{
"id": "100001643068103",
"name": "Umut Ayg\u00fcn"
},
{
"id": "100000165334510",
"name": "Alessandra Milfont"
},
{
"id": "100001472353494",
"name": "Sayer Mohammad Naz"
},
{
"id": "1051008973",
"name": "Jenson Daniel Chambi"
},
{
"id": "100000233515895",
"name": "Ruby Atiga"
},
Using this output you can simply count the number of entries in the data array to get the like count.
Note that all of this is possible from using the graph explorer by clicking on ids in the output box and the connections sidebar (except for the last /likes connection, which will hopefully be added soon. I hope this helps. Also, you do not need an access token to do any of this because pages are public. Hope this helps!
You can get the comments/likes count without having to paginate through all likes by using the fields parameter in combination with likes.limit(1).summary(true). For example, a search api query for pizza below will give you all public posts and their likes count summarized:
https://graph.facebook.com/search?q=pizza&type=post&fields=id,name,likes.limit(1).summary(true)
results (truncated):
{
"data": [
{
"id": "47883936273_659693910762305",
"name": "Instagram",
"created_time": "2014-02-16T01:15:29+0000",
"likes": {
"data": [
{
"id": "100002243084532",
"name": "Yvette Martin"
}
],
"paging": {
"cursors": {
"after": "MTAwMDAyMjQzMDg0NTMy",
"before": "MTAwMDAyMjQzMDg0NTMy"
},
"next": "https://graph.facebook.com/47883936273_659693910762305/likes?limit=1&summary=1&after=MTAwMDAyMjQzMDg0NTMy"
},
"summary": {
"total_count": 13682
}
}
},
{
"id": "136336876521150_314001148754721",
"name": "Pizza Box Turns into Plates & Storage Unit!",
"created_time": "2014-02-15T21:20:00+0000",
"likes": {
"data": [
{
"id": "100005373008864",
"name": "Liliana Campoli"
}
],
"paging": {
"cursors": {
"after": "MTAwMDA1MzczMDA4ODY0",
"before": "MTAwMDA1MzczMDA4ODY0"
},
"next": "https://graph.facebook.com/136336876521150_314001148754721/likes?limit=1&summary=1&after=MTAwMDA1MzczMDA4ODY0"
},
"summary": {
"total_count": 2792
}
}
}
/me/feed returns a LIKES field
I used a solution where I simply find the number of items in the array which display LIKES
Object.keys(item.likes.data).length
This returns the "length" of an object -- which is equal to the number of likes.
http://graph.facebook.com/223766074374957
there is a likes property in the response
{
"name": "Bejeweled Blitz",
"is_published": true,
"website": "https://apps.facebook.com/bejeweledblitz/",
"username": "bejeweledblitz",
"products": "Bejeweled Blitz\nBejeweled\nPlants vs. Zombies\nPeggle\nZuma\nChuzzle\nBookworm Adventures\n \nFor a complete list, please visit www.popcap.com\n ",
"about": "We're the award-winning hit, Bejeweled Blitz! The lightning-fast puzzle game where you have just 60-seconds to match as many gems as you can! Start Blitzing now!",
"general_info": "Speed is the name of the game in Bejeweled Blitz! Bejeweled Blitz is a speedier take on the classic Bejeweled match-3 gem game mechanic. Your goal is to make as many matches as you can in 60-seconds to really make your score soar! But you won't be going it alone! There are special ways to enhance your Bejeweled Blitz game - like Boosts (power-ups like Scrambler, which moves all the gems around the board or +5 seconds, to add 5 seconds more gem-matching time!) and the popular, Rare Gems. Rare Gems are like extra-special power-ups that can REALLY take your game to the next level!",
"talking_about_count": 22487,
"category": "App page",
"id": "223766074374957",
"link": "https://www.facebook.com/bejeweledblitz",
"likes": 5796324,
"cover": {
"cover_id": 383412771743619,
"source": "http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash4/s720x720/417018_383412771743619_1056862875_n.jpg",
"offset_y": 0
}
}