Facebook Graph API: read posts by other apps on users wall - facebook

this is my first question on stackoverflow. Tried searching for this but none of the answers helped.
The problem is that im trying to use Graph API's read_stream permission to read the users stream. That works (mostly) but what i'm really instrested is posts from other apps like Endomondo and Runtastic (sports tracking stuff) -- but they dont show up at the graph explorer, only posts by the user himself.
What can i do?

You will need the proper OG action permission. For example, assuming Runtastic is a fitness action application, you will use user_actions.fitness permission and then call /me/fitness.runs
{
"data": [
{
"id": "10101174611725617",
"from": {
"name": "☃",
"id": "4"
},
"start_time": "2013-05-24T20:22:26+0000",
"end_time": "2013-05-24T20:22:26+0000",
"publish_time": "2013-05-24T20:22:26+0000",
"application": {
"name": "runtastic.com",
"namespace": "runtastic",
"id": "162918433202"
},
"data": {
"course": {
"id": "375109895929036",
"url": "http://www.runtastic.com/en/users/☃/sport-sessions/75329736",
"type": "fitness.course",
"title": "a 0h 0m 20s run"
}
},
"type": "fitness.runs",
"no_feed_story": false,
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
},

Related

facebook graph api doesn't return the statuses i shared

I'm trying to fetch all my facebook timeline posts throw the facebook Graph API.
I'm playing with the Graph Explorer and have an access token with this permissions: (user_posts, read_stream) but when i call the endpoint "/posts" or "/feed" in the graph-api, the statues i shared (not i created) on my timeline (friends public status that i shared) didn't return.
this is a screenshot from my timeline
any idea?
If you share another POST - status then I dont think there is a way that will show up in your feed. It will show up under the user's feed who originally shared it, under posts and sharedposts
But if you share a link then it will show up under your feed as shared_story
Example from my feed
{
"data": [
{
"id": "XXXXXXXX",
"from": {
"id": "XXXXXXXX",
"name": "XXXXXXXX"
},
"story": "Vrashabh Irde shared a link.",
"story_tags": {
"0": [
{
"id": "XXXXXXXX",
"name": "XXXXXXXX",
"type": "user",
"offset": 0,
"length": 13
}
]
},
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAvV7MyLsxFjRDc&w=130&h=130&url=https%3A%2F%2Ftctechcrunch2011.files.wordpress.com%2F2015%2F05%2Fdave-goldberg.jpg%3Fw%3D560%26h%3D292%26crop%3D1&cfs=1&sx=1&sy=0&sw=292&sh=292",
"link": "http://tcrn.ch/1GR0HU3",
"name": "Dave Goldberg, SurveyMonkey CEO, Dies Unexpectedly",
"caption": "tcrn.ch",
"description": "Silicon Valley and the wider world of technology are mourning the very sudden death of Dave Goldberg, a long time entrepreneur and investor, CEO of..",
"icon": "https://www.facebook.com/images/icons/post.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
},
{
"name": "Like",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
}
],
"privacy": {
"value": "ALL_FRIENDS",
"description": "Your friends",
"friends": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2015-05-03T14:45:09+0000",
"updated_time": "2015-05-03T14:45:09+0000",
"is_hidden": false,
"subscribed": true
}
This is from what I know, I dont see any documentation that says otherwise, good to have someone from Facebook comment here or you should probably raise a bug if this is not intended.

Publish a story on Facebook timeline

I'm very new to Facebook Open Graph. What I want to do is simply when a user opens a webpage, it will send a story to his/her timeline. I have created an "Eat a Meal" action on Open Graph. When I click Get code, I get something like this :
https://graph.facebook.com/me/project:eat?
access_token=ACCESS_TOKEN&
method=POST&
meal=http%3A%2F%2Fsamples.ogp.me%2F325653997592127
When I click on this code, I am redirected to another page. I get an Access Token there and then when I click submit I get something like this :
{
"id": "274655529384281"
}
When I click the id, I get this :
{
"id": "274555552716206",
"from": {
"id": "274673726099999",
"name": "Jason McJason"
},
"start_time": "2014-07-16T14:23:26+0000",
"end_time": "2014-07-16T14:23:26+0000",
"publish_time": "2014-07-16T14:23:26+0000",
"application": {
"name": "Project",
"namespace": "project",
"id": "325123427594834"
},
"data": {
"meal": {
"id": "539535656565608",
"url": "http://samples.ogp.me/325625656562127",
"type": "project:meal",
"title": "Sample Meal"
}
},
"type": "project:eat",
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
}
But I don't know what to do with all of this data. I just have a simple HTML page. Where should I put these data? I'm a little lost and Facebook's documentation didn't help much. I'd appreciate if you tell me what to do with these. Thanks.
You need to integrate Facebook JS SDK on your web page.
Read up through this documentation- https://developers.facebook.com/docs/javascript/quickstart/v2.0
The very last example creates a post.

Get more detail from Facebook Notifications?

I'm writing an app that gathers info from a users Facebook notifications. Using the Graph Explorer, I request:
me/notifications?include_read=true
and this returns a bunch of data. Each item is a notification item you would see when logging into Facebook. For example (ID/names changed slightly):
{
"id": "notif_630262196_168132987",
"from": {
"name": "John Bloggs",
"id": "822724665"
},
"to": {
"name": "Dermot Bloggs",
"id": "680265196"
},
"created_time": "2013-01-23T22:58:28+0000",
"updated_time": "2013-01-23T22:58:28+0000",
"title": "John Bloggs commented on your link: \"Goodbye Great Barrier Reef. Goodbye...\"",
"link": "http://www.facebook.com/<removed>/posts/330788937030559?comment_id=1702155",
"application": {
"name": "Links",
"id": "2309869772"
},
"unread": 0,
"object": null
}
The notification is in relation to a comment, but the "title:" field gets truncated if it is too long.
Is there a clean way I can programmatically access the comment directly, so I can get all the text, even if it is a 1000 character comment?
Thanks! :-)
You should be able to get the comment by parsing the link field and querying:
/330788937030559_1702155
or
/POSTID_COMMENTID
When I tested this on my account, I am getting a comments object in the returned data, with the full text of the comments. I've got most permissions enabled in my Graph API. I suspect adding read_stream to the permissions is what will give you this data.
You can avoid parsing! I've been doing a lot of experimentation with notifications and getting what I've called the 'source' object (the source object being the Facebook Graph Object from which the notification originates). Unfortunately, I can't find any documentation on how exactly this mechanism works, but if your app has been granted a lot of permissions, the "object" field which in the JSON you posted is null will actually be populated with the 'source object'. Instead of just "object" : null it will look like this:
"object": {
"id": "587140489_588632201147717",
"from": {
"name": "Dave Rodríguez",
"id": "587140489"
},
"message": ":D ",
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632550_478955408819349_478954732152750_60483_1892_t.jpg",
"link": "https://www.facebook.com/photo.php?v=478954732152750",
"source": "http://video.ak.fbcdn.net/hvideo-ak-prn1/v/754708_478955348819355_1792301950_n.mp4?oh=c7295ccfc3773f24de931e4c29f512ce&oe=513F1728&__gda__=1363127340_9302c108824176369427a0b17491b800",
"name": "¡¡¡EL SECRETO DE LA CHANCLA!!!!",
"description": "EL SECRETO DE LAS MADRES, EL MÁS UTILIZADO EN TODAS LAS GENERACIONES, VÉALO USTED MISMO Y ((COMPARTA))!",
"properties": [
{
"name": "Length",
"text": "1:13"
}
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
},
{
"name": "Like",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
}
],
"privacy": {
"value": ""
},
"type": "video",
"status_type": "shared_story",
"object_id": "478954732152750",
"application": {
"name": "Video",
"namespace": "video",
"id": "2392950137"
},
"created_time": "2013-03-10T20:45:20+0000",
"updated_time": "2013-03-10T20:45:20+0000",
"likes": {
"data": [
{
"name": "Adrian Guerra Cuenta Verificada",
"id": "674364748"
}
],
"count": 1
},
"comments": {
"count": 0
}
}
I hope somebody more knowledgeable than me can tell us exactly what permissions we need to see this field populated. I'd figure it out myself but there are so many permissions that brute-forcing the SUM(nCk(77,k),k,1,77)=151115727451828646838271 possible combinations of permissions would take a very long time.

Facebook 'Like' count on website is much lower than Facebook page

The "Like" count on my articles has been very low for the past few months. For example, an article has 190+ "Likes" on this Facebook page:
http://www.facebook.com/BatmanNewsCom/posts/282806528452384
and 321+ "Likes" on this Facebook page:
http://www.facebook.com/TDKRises/posts/208282902603624
But my website is only displaying 157 "Likes" for that article. This has been a problem with every article I've posted since around the middle of December. Any idea what could be wrong? Shouldn't they be in sync with the Facebook pages, and any other "Likes" elsewhere?
If anyone could help point me in the right direction, I'd really appreciate it. Thank you!
The 321+ "Likes" on https://www.facebook.com/TDKRises/posts/208282902603624 are "Likes" on that actual POST on facebook. The 157 "Likes" on this article http://batman-news.com/2012/02/09/heath-ledgers-joker-the-dark-knight-featured-in-oscars-ad/ are "Likes" for that URL. Facebook does not add "Likes" for a URL and "Likes" for a POST containing the said URL together; they are kept as two separate entities.
For instance, here's a link using FQL to query the link_stat table.
https://api.facebook.com/method/fql.query?query=SELECT+url%2C+normalized_url%2C+share_count%2C+like_count%2C+comment_count%2C+total_count%2C+commentsbox_count%2C+comments_fbid%2C+click_count+FROM+link_stat+WHERE+url%3D%22http://batman-news.com/2012/02/09/heath-ledgers-joker-the-dark-knight-featured-in-oscars-ad/%22&access_token=AAAAAAITEghMBAP3WZAm1IZCLto32KgEjjYbk5zCsRyZAf7YSSQyxBdqBXZAZBhqsKxZCpAnLUuOXV8lHzjmfuZCeJPRXv2GvBSmnENLVVlvhwZDZD`
And it returns this result:
<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
<link_stat>
<url>
http://batman-news.com/2012/02/09/heath-ledgers-joker-the-dark-knight-featured-in-oscars-ad/
</url>
<normalized_url>
http://www.batman-news.com/2012/02/09/heath-ledgers-joker-the-dark-knight-featured-in-oscars-ad/
</normalized_url>
<share_count>104</share_count>
<like_count>53</like_count>
<comment_count>0</comment_count>
<total_count>157</total_count>
<commentsbox_count>0</commentsbox_count>
<comments_fbid>10150538028142844</comments_fbid>
<click_count>0</click_count>
</link_stat>
</fql_query_response>
Which shows the "Like" count you're getting on your page to be how many people "share" that URL + how many people like that URL.
Now if you do a Graph API query against the post ID, you can see that the like count does differ between URL and post.
https://graph.facebook.com/117326344965823_208282902603624
With a response of:
{
"id": "117326344965823_208282902603624",
"from": {
"name": "The Dark Knight Rises",
"category": "Movie",
"id": "117326344965823"
},
"story": "The Dark Knight Rises shared a link.",
"story_tags": {
"0": [
{
"id": 117326344965823,
"name": "The Dark Knight Rises",
"offset": 0,
"length": 21
}
]
},
"picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQDJ1A-Ok89RPwkn&w=90&h=90&url=http\u00253A\u00252F\u00252Fcdn.batman-news.com\u00252Fwp-content\u00252Fuploads\u00252F2012\u00252F02\u00252F846x476-175x165.jpg",
"link": "http://batman-news.com/2012/02/09/heath-ledgers-joker-the-dark-knight-featured-in-oscars-ad/",
"name": "Heath Ledger\u2019s \u2018The Dark Knight\u2019 Joker featured in Oscars ad",
"caption": "batman-news.com",
"description": "The Oscars air live on February 26th and today a new ad campaign was revealed. The ads all feature a reference to a great movie of the past. One of those great movies happens to be The Dark Knight...",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yD/r/aS8ecmYRys0.gif",
"type": "link",
"created_time": "2012-02-09T17:17:40+0000",
"updated_time": "2012-02-10T17:38:52+0000",
"shares": {
"count": 29
},
"likes": {
"data": [
{
"name": "Ahmed Yagoub",
"id": "1484476725"
},
{
"name": "Ryan Watkins",
"id": "725002161"
},
{
"name": "Buddy George Fonseca",
"id": "100001448442792"
},
{
"name": "S\u00edlvio Teixeira Leite",
"id": "100002240617284"
}
],
"count": 324
},
"comments": {
"data": [
{
"id": "117326344965823_208282902603624_786248",
"from": {
"name": "Chalerm Chaimongkol",
"id": "100002659449106"
},
"message": "You are the best, Heath Ledger. :)",
"created_time": "2012-02-09T17:20:59+0000",
"likes": 1
},
{
"id": "117326344965823_208282902603624_786250",
"from": {
"name": "Bradley Wayne Instance",
"id": "100003120853077"
},
"message": "Long Live Joker :)",
"created_time": "2012-02-09T17:21:08+0000",
"likes": 5
},
{
"id": "117326344965823_208282902603624_786259",
"from": {
"name": "Nilabh Singh",
"id": "531292994"
},
"message": "Greatest character ever in the history of Cinema.\nR.I.P Heath Andrew Ledger.\nYou were a legend.",
"created_time": "2012-02-09T17:22:15+0000",
"likes": 10
},
{
"id": "117326344965823_208282902603624_786291",
"from": {
"name": "Camie Chaos",
"id": "517844186"
},
"message": "\u003C3\u003C3\u003C3",
"created_time": "2012-02-09T17:25:45+0000"
},
{
"id": "117326344965823_208282902603624_786313",
"from": {
"name": "Anand Tiwari",
"id": "1321947394"
},
"message": "you are a legend!!!",
"created_time": "2012-02-09T17:28:51+0000"
},
{
"id": "117326344965823_208282902603624_786314",
"from": {
"name": "Manoj Biswal",
"id": "100001010999210"
},
"message": "indeed great character",
"created_time": "2012-02-09T17:29:13+0000",
"likes": 1
},
{
"id": "117326344965823_208282902603624_786327",
"from": {
"name": "Lee Duller",
"id": "100003188571395"
},
"message": "Love that joker!",
"created_time": "2012-02-09T17:36:30+0000",
"likes": 2
},
{
"id": "117326344965823_208282902603624_786329",
"from": {
"name": "Ben Cribbett",
"id": "633801171"
},
"message": "was a amazing joker, i have him tattoo'd on my arm R.I.P. :(",
"created_time": "2012-02-09T17:37:19+0000",
"likes": 2
},
{
"id": "117326344965823_208282902603624_786346",
"from": {
"name": "Eric Jones",
"id": "1343067459"
},
"message": "GLAD he won, but screw the Oscars. TDK should've been up for many more awards, Ledger should have won BEST ACTOR (not supporting as anyone who has actually seen the movie knows it is as centered around him as much as Wayne/Batman), and Harry Potter & Xmen: First Class are snubbed this year?!?\n\nin a year of HIGHLY overrated & underwhelming films? what a joke & w/out a great punchline like The Joker would deliver.\n\nwill find anything better to do than waste time on this stupid awards show this year. hell, i missed most of the SAG Awards and they're way better than the Oscars.\n\nbut First Class was one of the best of the year, bar none, and topped a good summer of VERY good blockbusters (minus Green Lantern, of course). to be totally snubbed & disrespected just shows what a bunch of geriatric douchebag assclowns The Academy is full of.",
"created_time": "2012-02-09T17:45:32+0000",
"likes": 2
},
{
"id": "117326344965823_208282902603624_786381",
"from": {
"name": "Boris Kopp",
"id": "100003049418181"
},
"message": "\"You changed everything.\" Thats true, Heath. You really changed everything with this once on a lifetime performance in The Dark Knight. In this role and many others, you stay alive in our hearts.",
"created_time": "2012-02-09T17:54:59+0000",
"likes": 2
},
{
"id": "117326344965823_208282902603624_786383",
"from": {
"name": "Ninad Naik",
"id": "100003125720497"
},
"message": "Why so serious...???\r\nLets put some smile on your face....:)\r\nHail Joker....!!!!\r\n",
"created_time": "2012-02-09T17:56:08+0000",
"likes": 2
},
{
"id": "117326344965823_208282902603624_786395",
"from": {
"name": "Taylan Erdem",
"id": "100001437162326"
},
"message": "the dark knight is old it is the dark knight rises!!!",
"created_time": "2012-02-09T18:00:09+0000"
},
{
"id": "117326344965823_208282902603624_786510",
"from": {
"name": "Nerd Rawk",
"category": "Entertainer",
"id": "259582000764594"
},
"message": "We discuss comic books in our latest podcast! http://nerd-rawk.podomatic.com/entry/2012-02-07T21_09_20-08_00",
"created_time": "2012-02-09T18:25:58+0000"
},
{
"id": "117326344965823_208282902603624_786512",
"from": {
"name": "Nisargh Ny S",
"id": "100000537517253"
},
"message": "hope jhonny depp replaces joker..",
"created_time": "2012-02-09T18:26:29+0000"
},
{
"id": "117326344965823_208282902603624_786532",
"from": {
"name": "Sergio Rossell Reyes",
"id": "1038781683"
},
"message": "wow, seems like the oscar's producers really want to make people watch this year's show.",
"created_time": "2012-02-09T18:33:36+0000"
},
{
"id": "117326344965823_208282902603624_786560",
"from": {
"name": "Andrew Kilian",
"id": "625429396"
},
"message": "Borderline bad taste.",
"created_time": "2012-02-09T18:40:29+0000"
},
{
"id": "117326344965823_208282902603624_786780",
"from": {
"name": "Peter Ike Amadi",
"id": "1617233525"
},
"message": "Heath, you changed things at the Oscars. Forever. You see some men aren't looking for anything logical, they can't be bought, bullied, reasoned or negotiated with. Some men just want to watch the Oscars burn...",
"created_time": "2012-02-09T19:49:05+0000",
"likes": 5
},
{
"id": "117326344965823_208282902603624_786844",
"from": {
"name": "Luke Hobbs",
"id": "1123606586"
},
"message": "and in 2013 tom hardy will win an oscar for his amazing performance in the dark knight rises as bane",
"created_time": "2012-02-09T20:11:48+0000",
"likes": 4
},
{
"id": "117326344965823_208282902603624_787859",
"from": {
"name": "Jackson Krista",
"id": "100000650880066"
},
"message": "http://www.youtube.com/watch?v=iyNqmiX_Xl8",
"created_time": "2012-02-10T02:32:41+0000"
},
{
"id": "117326344965823_208282902603624_790194",
"from": {
"name": "Kishan Herchandani",
"id": "1849953622"
},
"message": "he deserves that",
"created_time": "2012-02-10T17:38:52+0000",
"likes": 2
}
],
"count": 20
}
}
Showing the likes to be 324 for the post. Hope that helps.
Christopher, I agree that up until fairly recently the Likes that a url got when shared as a link on a wall post used to increase the count shown on the Like button. I started a thread about this on the Facebook specific Stack Overflow here: http://facebook.stackoverflow.com/questions/8944567/likes-on-link-wall-post-not-counting-on-like-button-plugin
Please let me know if you figure out anything else.

Is there a way to get recent video.watches activity for a specific app?

I want to give the user a UI to delete activity. I'm aware of it, but I'd rather not use the Activity social plugin. I know that it is possible to get activity using Graph API:
me/video.watches
example response:
{ "data": [ {
"id": "10101573590568760",
"from": {
"id": "123546",
"name": "John Doe"
},
"start_time": "2012-02-01T18:53:34+0000",
"end_time": "2012-02-01T18:53:34+0000",
"publish_time": "2012-02-01T18:53:34+0000",
"application": {
"id": "123456789123",
"name": "test_app"
},
"data": {
"movie": {
"id": "123456789123456789",
"url": "http://example.com/movie/My-Movie-Title",
"type": "video.movie",
"title": "My Movie Title"
}
}, "likes": {
"count": 0
}, "comments": {
"count": 0
}
}
However, for global action types, this may return other apps as well. I am only interested in my app specifically. Is there a way to limit returned data to my app only?
Appears that video.watches only returns activity items for the current app.