Facebook API: definitely NOT possible to get pool results (votes)? - facebook

talking about Facebook's polls:
it is confirmed that in AD 2018 the votes of a poll posted on a page are
IMPOSSIBLE to gather using the Graph API ?
Could somedody confirm this ?
thanks
cp

The option to get access to polls has been removed a long time ago, as you can read here:
https://developers.facebook.com/docs/graph-api/reference/question
https://developers.facebook.com/docs/graph-api/reference/question_option

Related

Facebook API Lead Ad webhook lead retrieval

I have setup a webhook for Facebook Lead Ads
It is receiving data like this:
{"object":"page","entry":[{"id":"718196074978224","time":1453818316,"changes":[{"field":"leadgen","value":{"ad_id":"399579767903","adgroup_id":"971076277715","created_time":1453789516,"form_id":"930912320812","leadgen_id":"151977133461","page_id":"718196074978224"}}]}]}
The next step is to retrieve the details.
The docs say
https://graph.facebook.com/v2.5/
but if I use the leadgen_id (151977133461) this returns
"singular published story API is deprecated for versions v2.4 and higher"
I've also read that _ might work, but that returns a different error.
Answered my own question: subscribed_apps wasn't set up correctly
You just need page access token to retrive the values from the lead. You need to make a GET call on
https://graph.facebook.com/v2.11/<leadgen_id>?access_token=<page_access_token>
For more info go through this link it will help you: http://tanmayverma.com/reactjs/storing-facebook-lead-data-in-our-database-in-real-time-using-reactjs-meteorjs-and-fbs-javascript-sdk/

Can only access sharedposts for some Graph API objects?

I have an access token for a page on Facebook. I can view that page’s feed, and individual posts in that feed. But for some reason, I can only request the /sharedposts endpoint for some of them using v2.2 of the Graph API.
The access token has the user_posts and read_stream insights. When I request the shares field I can see more than one post with shares, but when I request [POST_ID]/sharedposts for some of them, I just get an empty data array in response.
Why is this? Are there some gotchas I should be aware of? It’s a tad frustrating that the /sharedposts edge will return returns for some posts but not others using the same access token and API version.
This is a know bug, which still seems to be unsolved.
Basically it should work like you expected, but even with all necessary permission (and even for public posts) it does not return the object with each of the shares.
You probably want to subscribe to the bug here to be noticed once it has been solved:
https://developers.facebook.com/bugs/1404733043148335/
I just posted my insight/workaround for this bug on the bug report that lars.schwarz linked to, but I'll paste it here as well:
/sharedposts will only retrieve public posts or posts from users who have granted your app access. HOWEVER, the endpoint does not seem to query for this intelligently. I'm not sure, but I think the endpoint has a default limit of 25 results. What appears to be happening is that the endpoint queries Facebook's database for 25 posts, then filters that set based on your app's permissions.
What this means is that if the most recent sharedpost your app is allowed to access is 30 posts deep, the endpoint will return an empty data set. If your app is allowed to access one post which is 15 deep, and one that is 30 deep, it will only return the post that is 15 deep.
In order to get around this, you can set a really high limit (I've been using 2000). The problem with this is that if your post has more than 2000 shares, you will still miss stuff. You can't make the limit insanely high, unfortunately, because the endpoint will return an error telling you to query for less data (even if the query would only actually return a handful of posts). Therefore, I've been setting a limit of 2000 and using the "until" parameter to move through the sharedposts chronologically.
Hopefully that helps clear things up. This is a major pain, and an imperfect solution (although it gets 99% of the job done I think). I encourage everyone to file a bug report on this here: https://developers.facebook.com/bugs
It appears that this bug has been around for years, and I was told yesterday that they have no short-term plans to fix it. If we file enough complaints, maybe they'll prioritize it higher.

Efficient Facebook Page data processing

There are multiple similar questions, but I could not find any helpful answer.
I have created Facebook application and going to fetch Page/Post data from Facebook on behalf of that application.
- I have special read_insights permissions on Page.
- I created access token with that permission for my Facebook App. (which will be automatically extended).
Today I faced to problem with getting transient errors:
Error, Code: 4, Message: Application request limit reached
Error, Code: 17, Message: User request limit reached
There are answers related these problems (Facebook api: (#4) Application request limit reached , Facebook OAuth Error: Application request limit reached).
According to the Facebook Platform Policy you should contact them,
If you exceed, or plan to exceed, any of the following thresholds please contact us as you may be subject to additional terms: (>5M MAU) or (>100M API calls per day) or (>50M impressions per day).
My App performed 300K calls during week , so it shouldn't exceed these limitations. I have contacted to Facebook but they haven't reply yet.
I would like to know what are the best practices for fetching data from Facebook. I need to fetch
1. /page_id?fields...
2. /page_id/posts?fields...
3. /post_id/likes?fields...
4. /post_id/comments?fields...
5. /page_id/insights/
6. /post_id/insights/
For 2-4 I can't use batch requests because of paginated results, I am taking with limit=100, for 5-6 I have created batch requests with specific insight URLs that I need, and already can't decrease number of calls anymore.
When I faced to
Error, Code: 4, Message: Application request limit reached
I created new App and for fetching Insights I granted read_insights permission by same Facebook user.
Then I faced to
Error, Code: 17, Message: User request limit reached
So I assume that if token would be generated by other user who has read_insights permission to new application it could work.
Can someone suggest what will be best approach to solve my problem? Should I configure multiple Page access tokens for my App (generated by different users) and switch between them when for one of tokens Error #4 or Error #17 is occurred?
Have you tried the following?
Using the realtime updates API to be notified about new posts and new comments on posts, rather than polling
(looks like you are doing this) Ensuring you're using the page access token for a page to fetch data for that page, and not the token of a user or another page
Caching data that's unlikely to change to avoid re-fetching
Requesting multiple posts in a single call rather than one post per call (using the ?ids=x,y,z syntax documented here: https://developers.facebook.com/docs/graph-api/making-multiple-requests )
Using those methods you may be able to avoid hitting this entirely

Facebook api, feed vs post and the weird results (and maybe some other feedback)

after studying pretty long on the FB api i finally understand the context these 'apps' work in and get access tokens etc. etc.
There is however, something that's bothering me. I'm pretty sure someone already asked, but i can't find the right search words, and im sorry in advance!
Ok here goes:
I'm building a webpage onto which i would like to show my last 10 facebook posts. The authentication flow i'm using is:
login to my site (Django app),
use the javascript api to log in to FB and get an access token,
send this access_token to the server via and xhr request,
have the server send a request to FB, changing the access_token into
a long-lived token and storing that token in the database so i can
use that long lived token for later requests.
QUESTION 1: Is this the right way to go?
QUESTION 2: I read and confirmed that my long-lived tokens are
valid for 60 days. The docs say this token is refreshed
automatically, how does this work, do i just have a log in again?
With the token (currently i just use access_token - short one - ) i query '/me/feed' or '/me/posts/' (all i want are status updates, photo's, shared links)
I understand the '/me/feed' > '/me/posts', because essentially, '/me/posts' are a subset of '/me/feed'.
QUESTION 3: Am i correct assuming posts are a subset of feed?
The results i am getting from these queries seem 'a bit off', as the feed edge gives me the 3 latest objects, whereas the posts edge gives me 16 post objects. I am playing with the 'limit' parameter, but that just responds 'erratically'. I found out the default limit is 500.
QUESTION 4: Why do i get more results from the posts edge than from
the feed edge?
QUESTION 5: Why don't i get 500 results as per default?
QUESTION 6: How come using limit=10 does not work properly?
Hopefully someone can point me in the right direction and help me with my questions.
Thanks in advance,
Niels

Application Request Limit issue (Occuring Random with Random Scenarios)

I have tried raising this concern on Facebook/Support/Bugs but they said I should post implementation issues here. I have read it everywhere and it seems to be quiet open issue till now. I am not sure, If this will be solved or not.
So, what we are doing is, we have clients - Android and iOS.
Apps on Android/iOS allows users to login into the app and generate the token on the basis of permissions set we have, and we are passing this token to server for fetching further data as and when required for client. As our userbase is increasing we are getting Application request limit reached quiet often.
We are fetching photos of users and their friends using FQL. So, when parallely fetching photos for around 8-10 different users, we are reaching the Application request limit sometimes, which is quiet random and we are not aware of the actual scenario when it breaks up and how. According to facebook the limit, which is 1M calls per day, but we are hitting around 80K - 1 Lac API calls in a day, but as users are increasing it is stretching a bit further, Less than or equal to 200 approax calls/user. We tried doing batch calls as well and we hit the application request limit as well.
If anyone of you could help us understand the complete concept of API limit and how this can be handled, then we will really appreciate the help. We want to understand how API limit is decided and it's rate is calculated over which interval so that we will be able to configure on our side accordingly.
Earlier in the day, we ran into a unique API call issue. Our server started to break for API calls for user tokens that are with us, we (on our systems, other than server) tried fetching the data for those tokens (Simple calls - /me or /me/home), and it was working alright for us but not for server, then we tried setting up another server and redirected the requests to our new server then this server works well for the same set of users. Not sure, what went wrong in this case and how it breaks up. Please help.
Many Thanks,
Reno Jones
Did you look at the Insights -> Developer section of developer.facebook.com for your app?
This will show you a breakdown per api call, including warnings and ones that are currently being throttled and why.
Also, are you sure you're using User token authorization and not just your App token?
Beyond that, we take the information from Insights to find api calls to cache on our side rather than hitting Facebook every time. You will likely have to do something similar if you're not already. They have limits for calling too often, as well as for requesting too much data. For those, we had to reduce the limits of historical data we requested.