How to get "real" author of the post on my page - facebook-graph-api

I would like to get the name of the person who published post/comment on my page when they answer "as a page". My attempts to get information via '/pageID_postID?fields=from' results in obtaining the name of the page as this is the information that normal person can see. When I look at the real feed manually via browser, I can see that comment/post was published by a specific person. It is possible to get this information?

Related

Facebook Graph API started to returning empty array for comments & likes [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.

Trying to understand the restriction difference between the Open Graph "follow" and "like" actions

Looking at these 2 articles:
Like: https://developers.facebook.com/blog/post/465/
You can publish stories to people who like your Open Graph Page the same way you write a Facebook post from your own wall. The stories appear in the News Feeds of people who have clicked the Like button on the Open Graph Page.
You can also publish using our API. If you associate your Open Graph Page with a Facebook app using the fb:app_id meta tag, you can publish updates to the users who have liked your pages via the Graph API.
Follow: https://developers.facebook.com/docs/opengraph/actions/builtin/follows/
Similar to the ability to subscribe to a user's posts on Facebook, users can now follow other users' Open Graph activities from a specific app. For example, on a movie review site, users can follow their favorite movie reviewers. When a user follows another user in your app, all of the content published in your app by the publisher is eligible to be displayed in the follower's News Feed even if they are not Facebook friends (as long as the privacy on the actions published allows the follower to see the post):
It appears that in both cases you can create an Open Graph object that lives outside of facebook and either "follow" or "like" it. Using one example provided in the articles you could for example make that object be
http//www.rottentomatoes.com/celebrity/tom_hanks/
If you decide to "like" Tom Hanks on the site, the page can publish news about Tom Hanks and they will show up in your News feed. (Assuming all permissions are ok, no worries there).
However if you decide to "follow" Tom Hanks on the site, if I understand correctly the requirements posted by facebook:
In this case, the document returned by fetching the URL should have an fb:profile_id meta tag which represents the Facebook ID of the user:
<meta property="fb:profile_id" content="lbRw_a8fwsz8u7a_-iL5bCxjJ8w" />
We recommend that the content of this field be the third_party_id of a user, which can be retrieved by adding ?fields=third_party_id to the request URL when retrieving the user's information, and described in the documentation for the Graph API User object.
This tag is not required, and follow actions will succeed without it, though followers will not see activity in their News Feeds without this.
since the page lives outside of Facebook, it won't have a third_party_id and therefore if the site publishes news about Tom Hanks, you will not see that news appear in your News Feed.
Is there any reason why things behave like this?
Similar to Like, Follow publishes a single story initially. Follow however allows an app to build a "subscribe" relationship between two facebook users in the context of your app. Consider the example below which also illustrates how third_party_id is used to create such a relationship:
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.

Getting which users shared a post

With the graph api, when I query for the feed of a user or page, there are some posts that have been shared by users, and I can see the data about the number of shares within the data section of one entity:
"shares": {
"count": 2
},
When browsing facebook, on that post, when I click on the icon that represents "show shares", something pops up that lets me see some users that shared the post, according to the comment "You can see only shares that are public or from friends."
So is there a way to get the user data from the shares with the graph api?
The API doesn't provide information about users who have shared a post / link. Its probably something they will add in the future, but it's not possible at the moment. Your best bet for this information is to scrape the UI to get this information, but you will run into lots of issues and it's probably not worth the effort.
Facebook does give information on who Likes and Comments on posts however, if its any consolation.

How To Get Historical "Facebook Page Likes" Data via Graph API or FQL

Was wondering if anyone knows how to get the historical data for any Facebook Page.
For example, number of fans for RedBull fan page on a given day in the past or for a given period that ends today so that I can show fan development of any page over a given period.
I tried it with the graph API and FQL (insights) but no luck.
https://graph.facebook.com/{USERNAME}/insights?fields=likes&period('week')&end_time_date('2011-06-26') --> empty result
Pulling the data via FQL also returns no results, plus it seems without a read_insights permission nothing is possible for page data
I'd need this to be available with only a generic user access token. This data is publicly available anyway. Result should be somewhat like this: http://www.socialbakers.com/facebook-pages/australia/
https://graph.facebook.com/{{pagename}}/insights/page_views?access_token={{access_token_key}}&since=1420070400&until=1421625600
Since & until parameter in the above code takes in unix time.
add necessary information in the {{ }} and this code should work.
Without insight permission I recommend that you write something to perform a nightly query on the page graph and record the stats you need. If the page is public most of the information shown on that site is available.
You could also scrape info from http://pagedata.appdata.com if the page has already been listed...

Actions do not appear on timeline

I'm developing an app which publishes actions to the timeline.
On the app settings, I've created the action "post" and use the built in object type "article".
Although my graph actions have not been approved by facebook, that should not be a problem, because I am logged in as the developer of the app.
My article URLs pass facebook's linter with warnings, but no errors.
When my app notifies facebook of the the post action, it appears to succeed. Facebook returns an ID representing the action.
When I use facebook's graph explorer to view that ID, the data appears to be correct, showing the correct action type and object data. (If there's a URL to browse the action on facebook, instead of the graph explorer, I do not know what it is).
Still, with all the above apparently working without errors, I never see the action on my timeline. Whether I browse my own timeline, or when logged in as a friend and another developer of the app, I never see any indication on facebook.com that the action was performed.
What am I missing to make my custom action appear on my timeline page?
I had a similar problem. I was using OG and I could post everything successfully, but the posts didn't appear in timeline, but only in the activity log in Facebook.
I just went to the settings of the action and set "Explicitly Shared: This action can specify the user explicitly shared an action." to ON.
Then in my piece of code I put "true" to the key "fb:explicitly_shared" while creating the OG object.
If no error is being returned it sounds as if there is an issue in your public page that is preventing Facebook from knowing what to post.
Have you double checked your OG: meta tags through Facebook's validation tool [ https://developers.facebook.com/tools/debug ]. While you need all of the values to be filled in, the type bit is the most overlooked and must be setup properly to link to your particular application and corresponding action.
If your OG: data is correct and validating you should also check the detail settings for your action and aggregations. If the phrase / tense bits are not filled in Facebook may be uncertain how to make your post appear back to on the timeline.
Discoverd the problem....
My article page include an article:author tag. The URL in that tag was not visible to anonymous users. So, I'm guessing, facebook visited that author URL and received a HTTP 403.
When I removed the article:author tag, the items started appearing on my timeline.
So be careful with all tags and put all urls through facebook's debug tool.
Hmmm Interesting
Was having the same issue...
Using the XFBML, fb:like with all required og meta tags validating on the linter.
Last month when I liked a 'product' on my website, the post was published on my fb timeline wall no worries. Nice, perfect!
Today after clicking Like, I noticed it wasn't publishing to my timeline wall at all... but was logged in the Activity Feed.
It did however post to my wall if I commented on the Like Button flyout comment section.
Then I found this
"Pages of type article do not have publishing rights, and will not show up on user's profiles because they are not real world objects."
https://developers.facebook.com/docs/opengraphprotocol/#types
I've been getting the same issue with a feed dialog post. The posts can be navigated to directly, but doesn't show on timeline. More details here:
Actions not appearing on timeline
I had a similar problem, but everything was actually working correctly. If you get a returned ID and your article appears in your RECENT ACTIVITY, then all should be good.
The perceived issue, your post not appearing in your timeline, is actually the correct behavior. Your post doesn't appear in your timeline because it should appear in your friends' timeline as an activity that you completed. Once they comment or like it, then it should reappear on your timeline.
For me the issue was the posts doesn't show on timeline for all users except me also it was public !, i fixed it by make turn on application as online to be available to all users