facebook real times updates

104 Views Asked by At

Currently, I am calling the graph api to find out about the "fan page likes". I sleep for 1 second between each call. After around 10,000 calls, I start to experience HTTP 403, which says essentially "Quota Exceeded".

So, because of this, I checking into Real-Time-Updates. Here, I really got into several issues: 1) Cannot subscribe for page/likes For some reason, I am getting this:

{
    "error": {
        "message": "(#100) \"likes\" is an invalid field name",
        "type": "OAuthException",
        "code": 100
    }
}

I can subscribe, though, to fields: name, feed!

2) The documentation does not reveal how to connect your subscription with the pages you are interested in.

So, I successfully subscribe, but do not know how to add pages to this subscription

Thanks,

2

There are 2 best solutions below

6
On

The docs don´t mention the page likes in the Realtime API, because it´s just not possible to subscribe. The error message tells you the same: "invalid field name".

Your only option to track page likes is what you do right now, but you need to increase the time between calls. Also, make sure you ALWAYS use an Access Token, at least an App Access Token. Btw, according to my tests, the Realtime API can take more than 10 seconds sometimes to kick in anyway.

About 100000 Pages a day: You should consider using a Page Access Token in that case, for every Page a different one. That should increase the limit a lot. Of course only Page Admins can create a Page Token though.

3
On

It's clearly outlined in the docs at https://developers.facebook.com/docs/graph-api/real-time-updates/v2.2#subscribing that you can't subscribe to a Page's likes. That's because Page likes are belonging to the User data domain, not the Page's domain.

To me, it's not clear if you're just interested in the number of likes of a certain Page, or the actual "Likers". If it's the last thing, it's not possible. If the first, why do you have to query each second for the Likes? What kind of application makes this neccessary?

And, do you use your app access token, or no access token at all?

You could use the endpoint

/?fields=id,name,likes&access_token={app_id}|{app_secret}&id=https://www.facebook.com/CocaCola

as outlined in https://developers.facebook.com/docs/graph-api/reference/v2.2/url/ to get the number of likes for the CocaCola Page, where {app_id}|{app_secret} is your app access token.