Facebook API - How to get content of specific comment using Facebook api? - facebook

I have been asked to create a Facebook app that reads a Facebook user's news feed.
For now I have found out how to read a Facebook user's news feed via the /[user-id]/home path. My issues is that I don't know how to get the content of a user's comment on a video/photo etc.. For example, when I call the /[user-id]/home path I can see that a user (friend of [user-id]) has made a comment on a "video-post". I can see the "news ID" of the friend's "action" as '[user-id-of-friend]_[id-of-post-commented-on]', but how can I get the ID of the actual comment, which I need to be able to retrieve the content of the actual comment? The comment ID should look something like '[post-id]_[comment-id]' if I am not mistaken. I need the comment ID to get the detailed information about the comment when making a call to the /[post-id]_[comment-id] path.
A possible, slow and tedious, workaround would be to get all the comments of the "video-post" (calling /[post-id]/comments) and iterate through all the comments until I find the comment of the specific user.

Related

Automatically find public posts and comments on Facebook and unlike/remove them?

I'm using Facebook for many years, and I've liked and commented a lot of friends posts (status, photos, etc). The problem is that I didn't pay attention to that these posts were "public" or "for friends only". As a result, a person who is not a friends of mine can now see all these contents using a request of Graph Search like:
Photos liked by USERNAME
Posts liked by USERNAME
Posts commented on by USERNAME
...
Of course I could remove likes and comments one by one from the Activity log, but it would take several months... I could also use the Toolkit for Facebook available on Chrome, but unfortunately it only proposes to remove ALL likes or comments, of any kind, whereas I want to do it only for public ones.
Edit: This Chrome pluggin is actually a fake, don't use it!
Is there a way to do it with Graph API?
This post seems to mention there isn't, but I'm not sure. I found this post for instance.
Edit: #CBroe confirms "Facebook has recently removed the ability to (un-)like objects in the name of the user" so I guess the latter link is obsolete?
Admitting we've retrieved the posts or comments ID, for instance by parsing the html response of the Graph Search result, then:
Is there another way to launch a request to FB which unlikes or removes posts/comments?
What do you think about it?
Thanks!

Get only timeline posts, from facebook feed request

I'm trying to build an app using facebook's JS SDK and Graph API, and got a little confused in process. The idea is simply to take every post user have created on his timeline. As listed in docs to do this you need to call feed connection, to get an array of post object representing posts users make to their wall.
The thing is when using standard request to get last 30 post (with read_stream permission)
FB.api('/me/feed?limit=30&format=json', function(response) {
//operations on response.data
}
in response graph api returns not only the timeline posts user made, but also some of comments on other peoples posts. So it seems feed doesn't return just "The user's wall." posts, as written in doc, but all things user posted. Request to */user_id/posts* is giving pretty much the same result.
The confusing part is that user text posts to his/hers timeline and comments on other people's posts have the same type of "status". The difference between them is that timeline post has it's content in "message" field and comment stores text in "story".
So my question: Is there a way to sort only timeline posts made by user, within a request itself?
So after facebook updated it's docs it is now clear that you need to call /{user-id}/posts to show only the posts that were published by user.
Call to /{user-id}/feed on the other hand returns the feed of posts, including status updates and links published by user, or by others on user's profile.
More about so called "derivative edges" here: https://developers.facebook.com/docs/graph-api/reference/user/#edges

Facebook Open Graph Follows

Similar to the ability to subscribe to a user's posts on Facebook, users can since today, follow other users' Open Graph activities from a specific app. For example, on a movie review site, users can follow their favorite movie reviewers.
There's no example of this yet, but if you submit the new follow action you'll get the code and have an idea of how it goes. It's very easy: hit(GET) https://graph.facebook.com/me/og.follows with a token and a profile ID. What I don't get is the third_party_id.
I have read this sentence over and over and still can't decode it: "This tag is not required, and follow actions will succeed without it, though followers will not see activity in their News Feeds without this."
How to use the third_party_id? And most important, from now on, only the actions from the the people I subscribe to will been seen on my feed?
Full info here: https://developers.facebook.com/docs/opengraph/actions/builtin/follows/
What I don't get is the third_party_id.
If you’re posting a follow action not for a facebook profile, but for an URL (as in the example, profile=http://www.rottentomatoes.com/celebrity/tom_hanks/), then that page has to have a <meta property="fb:profile_id" …> element to tell Facebook what to actually follow.
To get the third_party_id, you query the Graph API for a user with /userid/?fields=third_party_id.
(I’m guessing using the third_party_id in this place instead of the actual user id is just recommended for the simple reason, that this way not everyone who looks into the HTML code of the rottentomatoes page can see what FB uid Tom Hanks actually has.)
If there is no corresponding user on Facebook for the URL that’s being followed – then there isn’t anything to follow at all, because there will be no posts on Facebook that could been shown in a user’s feed.
How to use the third_party_id?
This could have been explained better by Facebook. I think it works like this:
Lets say William followed Claudette in your app and that your app successfully published a follow action on facebook. Whether you provide Claudette's third_party_id or not, a story that William followed Claudette, will get published on William's News Feed.
However if Claudette's third_party_id is provided, then William will start getting stories about ALL of Claudette's actions published by your app. Now, thats pretty cool. But of course to do this, Facebook needs to know "who Claudette is" which is what third_party_id does.
To summarize, by not providing third_party_id the follow action gets shared on William's news feed and potentially to William's friends. But thats a one time thing. By providing the third_party_id you are extending the virality and ensuring a constant flow from Claudette to William for actions Claudette does on your app.

Finding user interactions on Facebook page through Graph API

Given a Facebook user id and a Facebook page id, is there any way to get find all interaction that user has done on the page (posting comments, liking posts etc) without first downloading the entire feed?
I have access key for the page and if necessary I can get one for the user.
For example on the page 315390295169855 (Ninja Saga page) user ID 100002190613755 has written a comment on the post 315390295169855_401357983239752. I would like to search that page so that such interactions could be found.
Things I have tried
I tried
https://graph.facebook.com/315390295169855/feed?q=100002190613755&access_token=FOO
But that doesn't seem to do the trick.
I have also considered first downloading the entire feed and then searching through it. However it turns out to be impractical, as for example the Ninja Saga page has tens of thousands of interactions and would likely cause the user to start playing farmville instead of waiting for the megabytes-long pre-search download to complete.
You have the answer there - pull the list of comments from the Posts you retrieve on the /feed connection of the page - i think the default return from a call to /feed includes a small number of the recent comments on each Post too, and you can retrieve the rest with a call to /POST_ID/comments

wall posts and fb:multi-friend-selector

Firstly i know that the documentation provided by Facebook says that fb:multi-friend-selector can be used in pair with fb:request-form and that it could only sends inviations or requests.
I have more specific need and that is not only to make invitations/requests but also along with the previous to post something on selected friends walls.
I've tried everything but i cant take the id's selected from the fb:multi-friend-selector, so i'm unable to make this posts.
The doucmentation for fb:multi-friend-selector says: This interface includes a series of which are included for selected users in the form that gets submitted to your action URL.
Is it somehow possible to catch this id's?
I'm working on my app in C# .net.
I read in some of the previous posts that is treating problematics similar to mine that is impossible to do this, but i found application that works perfectly in way that i want to make my application.
Thanks in advance,
Ivan
You can access the selected friend's id in the page that you are providing in "action" of fb:request-form.I am working with PHP so i am able to get those selected friend's id as $_REQUEST['ids'].So try some equivalent methods in c# for this.And if you get the friend's id you can publish to their wall.