Legal ways to get all recent posts of multiple Facebook pages as soon as possible? - facebook

I want to get all the newest posts from 10 (or let's say 1xxxxx) Facebook pages (which I do not own) as soon as they there published without manual refreshing all 10 pages every second. What legal tools should I use?

Use the Facebook Graph API. It allows you to get your application notified via callback HTTP posts whenever certain updates occur. You'll find the API documentation for this feature here:
https://developers.facebook.com/docs/graph-api/real-time-updates/v2.2
Based on your usage, you may have to pay for that service.

Related

Why Facebook Graph API doesn't list all public events for a page?

There're lots of events for this venue:
https://www.facebook.com/pg/ClubRoxyPrague/events/
However when requesting with Graph API we only get a few. Here's link to Graph API explorer:
https://developers.facebook.com/tools/explorer?method=GET&path=ClubRoxyPrague%2Fevents&version=v2.12
Until recently this worked well for us. Maybe it's data access restrictions Facebook announced few days ago: https://newsroom.fb.com/news/2018/04/restricting-data-access/
Why the API returns only some events? Is there any way to fetch all public events hosted by a certain page?
Due to the breaking data access changes you mentioned, it already wasn't possible to access events directly (also see: Unsupported get request in get Facebook event).
It seems like your specific issue is a logical consequence of that decision (although the /{page-id}/events was still available up to today, I personally already found it pretty strange that events were still accessible indirectly).

How to get Facebook share count for all links shared using a given application via Facebook API

Is it possible to get a list of statistics/analytics for all the links shared using a server-side Facebook application via the Facebook API?
I have a list of links that can be shared to Facebook using the appId defined in my server app. In order to refresh the share count of those items, I'm currently calling:
http://graph.facebook.com/{MY_URL}
whenever I want to update those values.
Obviously, this solution is not very scalable, because the number of items constantly grows so I can't call the method on all the URLs in sequence. Alternatively, this information can be fetched every time it needs to be visualized to the users. However, this can mean that the same request will be made to Facebook API in quick succession even though the chances of anything changing are small.
Ideally, I would like to get a list of all the links/items shared using my application with the share count for each of them. This way I can do a nightly update of all the values without going one by one.
I'm using the
me/links
API method to share the links to Facebook.
Analytics of a post, shared by a page can be accessed by the Insights API
Below id the Graph API call to access the count of clicks sent to your domain by a certain post.
/v2.4/<object-id>/insights/domain_feed_clicks?period=lifetime
If this is not what you're looking for, please refer to the permalink mentioned above and find the metric which best suits your need.
I would like to get a list of all the links/items shared using my application
The API does not provide that kind of list.
To reduce the number of API requests you have to make, you can request the data for several URLs in one go though: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.4#multirequests
https://graph.facebook.com/?ids=http://example.com/foo,http://example.com/bar,…
(You should properly URL-encode any URLs you use a parameter values here of course.)

Can my Facebook App programatically subscribe to real-time-updates on multiple Page/User profiles?

I would like to get notified programatically (using the callback URL) that any one of 100 Facebook Pages (or a User, but less important) has posted a new post to their Timeline/Feed or edited some of the Page details such as opening times for example.
My understanding from reading this documentation https://developers.facebook.com/docs/graph-api/real-time-updates/v2.3 is that I can "Subscribe" to changes programatically for multiple Objects (i.e. 50 Pages and 100 Users) using my App providing i have Permissions to do so from the User (I only want publicly available Page data).
I don't see the value in this "Subscribe" functionality if it does not do what the above requirements describes
Update: I have edited the question slightly as the initial question was found to be a bug in the Facebook user documentation as discovered by the comment below.
https://developers.facebook.com/docs/apps/changelog#v2_2_new_features
There is a new endpoint called subscribed_apps - you can connect an App to a Page without adding it as Tab now, so it does not show up for the users. The rest is the same, you still need /subscriptions to add a subscription (with callback and object) - but there is a bug in the docs, it´s not removed in v2.3: https://developers.facebook.com/bugs/799294656844725/
Btw, of course you can´t subscribe to a Page you don´t own. You have to be Moderator at least.

Reading user's posts to pages

For a given Facebook user, is there a possibility to read all posts that he's made to any pages? On FB web, these can be found in the activity log, but so far I couldn't find a method to get them via API.
Both /user/posts and /user/feeds only contain status and profile updates, not posts to pages. I know I can read /page/feed and use paging to find this user's posts for any page the user likes, but how about those he doesn't?
No, outside of FQL, there is nothing in the API that accomplishes this. I'd imagine this to be a pretty data intensive call with minimal use cases however, so I don't think this will be introduced anytime soon.

Remove Facebook page likes automatically with Facebook API

As detailed in the my post on IT Security Stack Exchange, I am the administrator for a page with a many recent unknown (an undesired) likes.
It was suggested to me to learn the Facebook API and write an algorithm to remove likes automatically, based on thresholds (ex.: remove a like if the user has a suspicious amount recent likes).
I'm aware of the many other posts discussing issues with retrieving the like count for a Facebook page, but was unable to find any posts discussing removing likes as the page admin.
Is this possible to achieve? If so, how would this be done?
Try looking into using the block method.
PAGE_ID/blocked?uid=USER_ID_YOU_WANT_TO_BLOCK
This should do the same as removing the like. I am not sure whether unblocking the user resets the like or not (works on Twitter) so you can look into that as well with a HTTP DELETE on the same call.
As far as I know there is no way to explicitly remove a like from a page.
For more information see http://developers.facebook.com/docs/reference/api/page/#blocked