facebook push realtime api for public page instead of manually checking - facebook

It seems weird that I can get a public page feed on facebook (posts, etc) by doing:
https://graph.facebook.com/cnn/feed?access_token=ACCESSTOKEN
but I can't get that info with their realtime api? Is it possible just to have any changes (posts created) get pushed to me with the realtime api by subscribing to a page, for example the CNN facebook page? It seems silly to just keep on having to hit the graph api every x minutes and check to see if there are any new posts since the last post id when the realtime api could just push them to me. Does anyone know a way to do this? What am I missing?
Thanks

In order to receive real time updates from the page, the app needs to be installed on the Page.
The real-time update settings doesn't let you specify a page_id so there is no way for Facebook to know which pages you want to receive updates from.
Seeing as you won't have permission to install apps to pages you don't have admin access to, you are limited to the method you are already using at the moment. The only way is to continue querying the API periodically and checking for changes.

Related

Get a notification when a facebook page post is made

I follow a facebook page which has some interesting posts and they post regularly. I want to write a python script that gives me a notification whenever the page posts something. Is there a way I can accomplish this in Python?
I have searched a bit, seems like graph API is the way to go. However, all the tutorials I have seen online give a way to scrape some data or get post information. I do not seem to figure out a way to detect when a new post is made.
How should I accomplish this task?
Notifications for changes or new posts can only be made with Webhooks - which are only available if you manage the Page. Scraping is not allowed on Facebook, so there is no way to get notifications for Pages you do not manage.
You could only check with the API on a regular basis, but you would need Public Page Content Access for that, and you may have a problem with API limits if there are many Page Posts or Pages you want to check.

Facebook and Instagram public data API

I want to build a dashboard that enables any company to track the social media activity of its competitors.
For example.. let's say you are a small business owner. You would be able to add the 'facebook/instagram page id's' of your 4-5 competitors within the app. The app would retrieve the historical data of your competitors.. and enable you to interactively explore what they are doing. How often they are posting, at the time of the day, what is liked/not liked, etc.
Problem is: Since Cambridge Analytica, Facebook requires app review to allow access to public page data. But how do I show the app.. when I don't have the data to build it?
Does anyone have any remote idea whether the thing that I am trying to build is generally within that would be considered permissible by Facebook?
You can still make your dashboard which will show your Facebook activity.
To get the Facebook page ID of 4-5 competitors. The competitors have to use your app and allow permission to your app for accessing public features.
You have to own a Facebook page. Get OAuth key. For every request to Facebook you will be using this Key. In case of mischievous activity your OAuth key will be blocked.
What you are trying to do is not possible these days and neither permissible by Facebook.
You can build your App already and just use your own Pages for testing - with a Page Token of those Pages. Send Facebook a video how you are using the data in the review process. I have recently got Page Public Content Access approved for that specific use case. Facebook just wants to see how you will use the public content, the App does not need to be 100% finished.
What´s allowed and what´s not allowed: https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS

Find out whether Facebook page is live streaming

Is possible to find out whether some facebook page is live streaming right now? I was looking at Facebook API and from there it seems to me that it is not possible since /{page_id}/live_videos seems to be working only if you are an admin of the page (or you have been granted the access) since you cannot read live videos of public without page access token.
Yes, you can. This is actually called a WebHook (simultaneous notification of a certain app/user about changes made on the page). To do this you will have to create a Facebook App that will be subscribed to the changes made on a certain page that you want to track.
You can simply do this from the dashboard of the app or through Graph API 2.7(since this version supports live_videos) calling {app-id}/subscriptions and choose any of Page Object Subscriptions, which are available through Facebook API(in your case live_videos).
For this kind of subscriptions your app needs to be whitelisted in order not to spam or re-transmit the information received from a certain page.
To get more information about WebHook implementation please read Facebook API documenation: https://developers.facebook.com/docs/graph-api/webhooks
I know this is quite late already but for those that may stumble on it like I did, Yes it's possible.
As clearly stated in the documentation
Page Live Videos - Facebook API Documentation
You will need to make a GET Request to the endpoint below with the appropriate parameters:
https://graph.facebook.com/v6.0/{page-id}/live_videos
Where page_id is the Facebook Page ID you with to check for active Live Stream
The endpoint also expect broadcast_status whose value for your use case would be LIVE
Note: You will need and app setup on Facebook for developers platform and your query would have to be via the app
Further details can be found in the documentation whose link I provided at the initial part of this answer.
You might be able to get a returned string if there is any, from:
GET /v2.7/{page-id}/live_videos HTTP/1.1
Host: graph.facebook.com
You can read more in: https://developers.facebook.com/docs/graph-api/reference/page/live_videos/

List Facebook Page events on website for a Venue using FQL or Graph API

I am helping out a friend with a site for a venue that lists all events on FB with a location, ticket URI, time, etc.
I have found lots of info on how to get the data, but what I am unclear on is how to get public events without being logged in to FB.
What type of tokens do I need to have a website simply pull events data and display it to visitors?
Basically, what I am attempting to do is show a set number of upcoming events and assume that the visitors to the site are not logged in to FB.
On this page, https://developers.facebook.com/docs/reference/fql/event, it says this:
Permissions
To read the event table you need:
a generic access_token for public events (those whose privacy is set to OPEN)
a user access_token with user_events permission for a user who can see the event for non-public events
an app access_token with user_events permission (for non-public events, must be the app that created the event)
a page access_token with user_events permission (for non-public events, must be the page that created the event)
I am not looking to get help with the code really, I am just having trouble figuring out how the access/auth process works.
It appears FQL may be the best option so I can do queries based on date ranges, but alas, I am stuck on the access/auth/token part.
What do I need to have in place to be able to list a Page's events on a 3rd party site?
If anyone has any advice there, I would appreciate it. Thanks.
Just to explain to others, you cannot get ALL the events in the city by graph search. You need to refine it either by user details or some other metric.
I figured it out.
This question helped, but was not correct and there is a syntax error in an answer:
Get Facebook events from public fan page
From what I found, you need to become an FB developer, create an app, get an ID and secret.
Use the SDK (PHP in my case), and this question had a good example of returning the list I want:
Link from ticket_uri is opening a blank page
I am having the same issue though of getting blank pages on the ticket link if the user is not logged into FB.
But my original issue is solved.

No new data after a RealTime update, and missing recent posts in OpenGraph /feed

I'm having a hard time getting access to most recent posts and comments for a given user using the OpenGraph API.
I have the read_stream permission, and get realtime notifications for feed field on the user object. The notification comes in, but fetching the /<user id>/feed stream doesn't include the new action.
When playing around with the Graph API Explorer, the data I see via OpenGraph and data I see by going directly to the page is different. Viewing my friend's profile, I see his latest update, yet it doesn't come back via /friend_id/feed. A comment I left a week ago shows in my /feed, but one from a few hours ago (which sent a realtime notification!) isn't showing up.
It's almost like some posts are filtered for the API. Is this how it's supposed to work?
My actual goal is to get all the comments made by my application's user.