Facebook User webhooks comment - facebook

I have set up user web-hooks for my Facebook Application successfully. I get a callback when a post is added to a user's feed but it only returns the id of the user, and the field that changed (in this case feed). This works when new content is posted to the user's feed, but when a new comment is added to an older post on that user's feed, it still only returns the id of the user, and the feed field.
Is there anyway to know which post a comment was made on without paging through the entire user's feed?

Related

get user info from facebook page visitor post [duplicate]

I have a Facebook comment and I would like to get the user ID of the author of the comment. I am able to get this information when the comment is posted on the page that I own with this query:
https://graph.facebook.com/v2.11/comment_id?fields=from&access_token=access_token
However, the same does not work when I am accessing a comment that is not posted on my own page, the from field is never returned. Is it possible to get the author of a comment that is posted on a different page?
Is it possible to get the author of a comment that is posted on a different page?
No, that information is not available to you any more.
https://developers.facebook.com/docs/graph-api/changelog/version2.11#gapi-90-pages:
/page/* — User information will not be included in GET responses for any objects owned by (on) a Page unless the request is made with a Page access token. This affects all nodes and edges that return data for objects owned by a Page.
If you are using a development account you cannot get the from user details of a user who comments on your posts. You can however create test users from your developer account, login with the test account, comment and retrieve their from details.

How to get post ID of Facebook shared URL, or how to get all posts shared via Facebook app?

Goal
My goal is for a user to share something he created on my site to Facebook, and for me to display all comments on my own page using the Facebook comments plugin.
So my ideal flow would be:
User creates content with example id vjrjf834fdkfj, and shares using public URL http://example.com/vjrjf834fdkfj/.
User shares this URL on Facebook via my Facebook app ID. The post ID is 1234567.
I get this post ID. (This is what I need help with)
I store this in my database.
Whenever a visitor visit the page http://example.com/vjrjf834fdkfj/ I look up in the database what the post ID is (1234567 in this example), and call the Facebook comments plugin using this post ID.
What I tried
Attempt #1
First failed attempt: read the post_id field of the FB.ui callback but this response is typically empty because Facebook says that:
Only available if the user is logged into your app using Facebook and
has granted publish_actions. If present, this is the ID of the
published Open Graph story.
My user is not always logged into my app via Facebook, because he can also create a normal account.
Attempt #2
So my next attempt was to get a list of all posts of this app by calling the Graph API. I have a "basic" app with the "Website" platform set to my website URL (www.example.com). Given this list I might filter this on the relevant URL and voila, get the post ID for the right URL.
I can create an access token and call https://graph.facebook.com/v2.8/{app-id}/objects?access_token={token}, but this gives an error The parameter type is required. And when I try to get a list of object types by calling the /object_types endpoint, I get an empty list.
Attempt #3
I also played a bit with creating a Page Tab but the documentation makes no sense to me as to how that would apply to my case. I ended up with two extra pages, all empty, and not what I want. However, I could live with an extra page on my Facebook page showing a list of all posts that have been shared (so these posts would appear here and on my user's timeline).
Questions
So:
Why is this object_types list empty? I expect that something like "post" would show up here, allowing me to get a list of all posts associated with this app ID.
If this is not possible, how can I still achieve my end goal?
Thanks.

/page_id/feed giving error 403 while publishing feed to a public page

As per the latest Facebook updates post to another user's (B) wall using feed is not allowed. The workaround as per my study is to use "TO" parameter if the session user_id (A) is different than the one whose wall is to be updated (B). I tried and it is working fine. The only issue is that the post is private and is not visible to A's friends.
The same "TO" doesnot work when I post onto a public page using page_id. I tried using /page_id/feed using page access token which worked but it posts onto page on behalf of page. I want to post onto B's wall which is a public page on behalf of a user (A). This is not working.
I have tried using app_id also, even that is not working.
To summarize, https://graph.facebook.com/{page_id}/feed?access_token={page_access_token}... works but posts on page on behalf of page itself. I need to post on behalf of session user.
Thanks.

How to get ALL of a user's Home Feed

Tweetdeck is able to get every single status update or wall posting on the user's 'Home' page. However, if I go to 'me/home,' I only get a subset of all the 'Home' page items. I'm assuming this is the case because the user's friends disable apps from retrieving their data.
So, why does Tweetdeck fetch more posts than I do? Is it a 'backdoor' or are they just using different code?
I I assume your using Facebook C# SDK. If so, there a special permission you have to request to read the user’s stream.
I believe the permission is called read_stream. As opposed to publish_stream which posts to the user’s wall.
read_stream returns an array of Post objects containing (up to) the last 25 posts.
https://developers.facebook.com/docs/reference/api/user/
Provides access to all the posts in the user's News Feed and enables your application to perform searches against the user's News Feed.
https://developers.facebook.com/docs/reference/api/permissions/

Facebook stream publish to app's wall, user's news feed AND user's wall

below is my FB api call in PHP5, which successfully publishes my feed to the App's Wall and the user's news feed.
$facebook->api_client->stream_publish($message, $attachment, $action_links, APP_ID, $facebook_uid);
I'd like to know if there's a way to publish the same feed to the app's wall, user's news feed AND user's own wall - all three places in one publish.
I could send the stream twice (once for the app and once for user's wall) but it gets hard to manage the comments/likes later on.
Any suggestion? Thanks in advance.
Posting to a user's feed will also have that Post appear in the users' friends' News Feeds - so two of the things you're asking for are already there via one publish.
Posting to the app's wall is something you probably shouldn't be doing from a user's perspective, as it won't be seen by anyone except people browsing the app's profile page's wall. If you do need to do this for some reason, just make a second publish call and change the target_id parameter to the page ID (old REST API) or Post to /<app page id>/feed if using the Graph API