Facebook GRAPH API - user's friends list does not return any data except total count - facebook

I created several test users in my App in Facebook developer account and granted all of them user_friends permission and also connected them together through 'Manage user's Facebook friends' option. However when I try to retrieve one of those user's friends list, it returns only total count of friend, but not their data .. Does anyone know why is that happening ? Thank you in advance..
Test users list
me/friends request and response
Granted permissions to test users

Its a known bug of Facebook which has been reported here for app type Consumer/Business.
https://developers.facebook.com/support/bugs/721152122632278/
https://developers.facebook.com/support/bugs/615773773588521/
But you won't have any issue if your app time is Gaming Service, or you create a test app of your main app but don't forgot to create test users, assign them 'user_friend' permission and add them as a friend with each other. I followed the same process after going through alot of research and finally it worked.

Related

Get facebook posts from group from others if I am NOT admin

SO, I belong to some facebook group. I am not admin and I want to get all posts from that group by others,
Idea is to filter those and get notification when someone posts something that passes filter.
Example, to get notification when post containing string "laptop" is posted.
Like this:
http://i.stack.imgur.com/yjaYT.jpg
I tries looking into facebook API but cannot find anything if I am not admin...
https://developers.facebook.com/docs/graph-api/reference/v2.2/group/feed
You can read the feed of a group with a User Access Token of any user that is member of the group, not sure what you found for Admins but they don't even get mentioned in the docs.
Keep in mind that you need the user_groups permission, and you will most likely not get it approved:
This permission is granted to apps building a Facebook-branded client on platforms where Facebook is not already available. For example, Android and iOS apps will not be approved for this permission. In addition, Web, Desktop and TV apps will not be granted this permission.
Source: https://developers.facebook.com/docs/facebook-login/permissions/v2.2

How to know if user's facebook's friends are registred on your site?

I want to create a 'Find friends from facebook' button on my site. Many websites have it, and it basically gets your friends from facebook and identifies those of them who are already registred on that website, to allow you add them as friends or whatever.
I have clicked that button on a very famous website and the website show me a list with my friends who are registred on that website, and almost 1/3 of my friends where there.
I have been reading the facebooks API, have created an app, and finally managed to create a 'Find facebook friends' button. But when I click on that button, my website receives from facebook only an array with the name and fb ID of every friend I have.
How is that usefull for me? How can I know who of them are registred on my website to show it to the user that clicked the button? I thought it should give me for example the email of each friend, so I can compare it to my DB and get the registred users, but, now that I think of it again, it's true that it is impossible due to several fb privacy violations.
How do those websites know who of your friends are registred by clicking the button?
Thank you very much!
You need to associate a user's Facebook ID with their account on your site (in the user DB table for example).
Then you have the list of all Facebook IDs of your friends. You can run a query in your DB to see which of your registered users' Facebook IDs match the ones from your query.
Basically the intersection of 2 list of FB IDs.
The ones in both lists are your friends registered on the site.
If you're happy to add an extra permission to your FB authentication (publish_actions) then you you don't need to keep your own list of users in a DB to get this info - you can query the scores API for the app. Just make a Graph call to /APP_ID/scores and it will return a list of friends of the current user who are using this app. Your application doesn't even need to publish any scores info - in this scenario, the API will just return scores of 0.
The addition of publish_actions does mean that there will be an extra permission dialog appearing when users connect to your app/site if you are not already requesting this permission.
Only friends who have given your app/site the publish_actions permission will be shown in the list - so if you have an existing site and have not previously requested this permission then friends who are old users will not be shown. Totally understand this might not be suitable for you and perhaps you should implement Fabien Warniez's solution instead.
Javascript example:
FB.login(function(response) {
FB.api('/145634995501895/scores', function(scoresResponse) {
$.each(scoresResponse.data, function(key, value) {
console.log(value.user.id + ':' + value.user.name);
});
});
}, {scope: 'publish_actions'});
Replace 145634995501895 in the above code with your application ID.

Facebook API Getting Friends of a friend

Good day, we are building an app that NEEDS to have information of user's friends' friends. For example: John logs into the app and he has 100 friends, each of those 100 friends also has 100 friends that equals to 10,000 people, application needs to get info like profile picture and basic info of those 10,000 people. We know that it was possible in the old API of Facebook, what happened now? If the current API doesn't have this function can we get exclusive access to this particular function for our servers only?
No, you can only access (non public) data about your app's users and their friends (subject to their privacy settings) - there's no permission which grants access to the friends of friends or their private data.

facebook api get friends likes returns empty array for some friends

i tried this with fql and the test console
https://developers.facebook.com/tools/explorer
checked the permissions
check with two accounts (no privacy issues)
checked the fb bugreports
clicking on friends then a user id then likes returns an empty array on some of my friends. i couldnt figure out why this is the case.
it seems to be pretty random but maybe i overlooked something
can someone help me on this?
If some person means Your app works fine for facebook developer account and other accounts not - check on You facebook developer account Status & review if Your app is On for public and not blocked for review.

Getting friend user id, and their photos

I am doing some research into the capacity of Facebook Connect. I have some questions on how a couple of bits of functionality.
Is it possible to fetch a list of all friends of a user?
The idea of this is that a user would log in using my site and then they could search through their friends and select one, and the site would get that friends users id and store it to the sites database.
Getting a photos from that user
After getting the friends user id, would it then be possible to get their photos? Or would the friend need to give the site permission to do that?
I am looking into a site where you can buy a greetings card for a friend, and i wanted to know whether my users would be able to login via facebook, pick a friend, get a photo and then at the time of their birthday it would send them a private message (which i think i know how to do) linking them back to my site where they could view the birthday card and their photo.
Thanks
To answer your questions:
Yes. Once you have an access token from the login process for a user, make a Graph API request to https://graph.facebook.com/me/friends. You can test this for yourself here: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends
Yes. During the login process, you must request user_photos and friends_photos permissions after which you can use the access token for a Graph API request to https://graph.facebook.com/USERID/photos. This will only return those photos for a friend which the user is allowed to see for the current privacy settings.