I implemented possibility to search friends from facebook who logged into my app using facebook.
It was working, I was getting one facebook id as I supposed, but now I trying to work about functionalities around this and I am getting empty data. I even check with other friend but still data for friends is empty. Something changed in last month?
{
"id": "49....38",
"name": "Karol Wiśniewski",
"friends": {
"data": [
],
"summary": {
"total_count": 359
}
}
}
EDIT: Yes, I have people who logged in using facebook to my app in friends
Related
I subscribed to feed webhook and I ve receiving posts everytime the user navigate and search something.
Is the expected behavior because documentation say:
Describes changes to most sections of the user's profile, such as About, Photos, Posts, Friends, and Likes
The json that I receive is:
{
"entry":
[
{
"time": 542196889466880,
"id": "0",
"changed_fields": ["feed"],
"uid": "XXXXXXXXXXXXX"
}],
"object": "user"
}
Can you provide JSON of Facebook you receive when the user navigate and search something?
I'm using webhook. I've only subscribed to webhook feed, and I only receive event data when user comment/post/reaction in my page.
My goal is to get a list of user facebook friends using Facebook Graph API. At least those, who have used social authentication on my website
I have read, that after v2.0 I can get only a list of friends, if the following conditions are met:
A user access token with user_friends permission is required to view
the current person's friends.
This will only return any friends who have used (via Facebook Login) the app making the request.
If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person.
When I get a token and check
/v2.5/me/permissions
Result:
{
"data": [
{
"permission": "user_friends",
"status": "granted"
},
{
"permission": "public_profile",
"status": "granted"
}
]
}
I am testing 2 user accounts, who are friends. I have used both for login in my web application using Facebook Login.
But when I do
v2.5/me/friends
Result:
{
"data": [
],
"summary": {
"total_count": 1
}
}
What is the reason of empty friends set?
Make sure all those friends authorized your App with user_friends too. If they only authorized without user_friends, they will not show up. The response looks like it worked correctly.
Sidenote: It is not allowed to have 2 user accounts on Facebook, you can only have one account - with your real name.
Context: For a Hackathon I building an app (web based - Ruby on Rails) that matches people based on their commun interests. For that I want to use Facebook connect and instantaneously get a person's likes so I can match him/her with someone with similar interests.
The problem: But apparently I can't access someone's likes through Facebook connect unless my app has been approved by Facebook. But without this login there is no app (and I can't wait 3-7 business days to have a working app).
Is there a way I can get my app to work (even if it's only with a set of approved users/testers)? Or do I have to come up with a an alternative page where my users will have to manually enter their interests?
No, there's no shortcut for the Login Review. What you can do is adding specific users (via your app's dashboard) you want to test your functionality with as admins/developers/testers of the specific app.
This will allow them to be able to grant your app extended permissions as user_likes without Login Review.
Also, I think Facebook already provides an endpoint for your use case:
/{user-id}?fields=context{mutual_likes}
which will produce something like
{
"context": {
"mutual_likes": {
"data": [
{
"category": "Media/news/publishing",
"name": "Mashable",
"id": "18807449704"
},
{
"category": "Food/beverages",
"name": "Coca-Cola",
"id": "40796308305"
}
],
"paging": {
"cursors": {
"before": "MTg4MDc0NDk3MDQ=",
"after": "NDA3OTYzMDgzMDU="
}
},
"summary": {
"total_count": 2
}
}
},
"id": "123456789"
}
See
https://developers.facebook.com/docs/graph-api/reference/v2.0/user.context/mutual_likes
https://developers.facebook.com/docs/graph-api/reference/v2.0/page.context/friends_who_like
https://developers.facebook.com/docs/facebook-login/review/how-to-submit#testpermissions
https://developers.facebook.com/apps/{your_app_id}/roles/
This question already has answers here:
Facebook API: Get fans of / people who like a page
(8 answers)
Closed 8 years ago.
I would like to build an app that tells user how many of his friends like a particular facebook page.
Let's say the name of page is Machester United. And I have 20 friends who like that page.
How can I do that? Should I use facebook graphAPI? Are there any other ways>
I am very new to this. Can you give me some key concepts/things that I should look into?
I think the Social Context API might be the right thing for you, if you're mainly interested in the number of friends which like a certain Facebook Page.
See https://developers.facebook.com/docs/facebook-login/social-context/v2.0
Use
GET /cocacola?fields=context.fields(friends_who_like)
to see which/how many of your friends like the CocaCola Page.
The result will look like
{
"context": {
"friends_who_like": {
"data": [
{
"id": "123456789",
"name": "Firstname Lastname"
}
],
"paging": {
"cursors": {
"before": "ODQ5MDkwMjQ2",
"after": "ODQ5MDkwMjQ2"
}
},
"summary": {
"social_sentence": "4 of your friends like this.",
"total_count": 4
}
}
},
"id": "40796308305"
}
The context.summary.total_count field will contain the number of friends which like the Page.
Try it here: https://developers.facebook.com/tools/explorer?method=GET&path=cocacola%3Ffields%3Dcontext.fields(friends_who_like)&version=v2.0
Keep in mind that
In order for a person to be identifiably returned in a context edge, they must have:
Logged into the app.
Granted the user_friends permission.
Granted the appropriate content permission in order to see the action. For example, to appear in the friends_who_like context edge, each friend has to have granted the app the user_likes permission.
When I ask for photos in certain albums I receive only part of the images, while when I use facebook.com I can see them all.
For example: /3738185490005/photos?fields=id returns 4 images:
{
"data": [
{
"id": "3805142683893",
"created_time": "2012-06-05T20:11:54+0000"
},
{
"id": "3744666692031",
"created_time": "2012-05-25T18:40:26+0000"
},
{
"id": "3738416375777",
"created_time": "2012-05-24T14:41:45+0000"
},
{
"id": "3738185530006",
"created_time": "2012-05-24T13:41:37+0000"
}
]
}
When I look at Facebook itself I see 9 images. Also when I look at the album call: /3738185490005 I see "count": 9. All images in this album are shared with Friends. I have seen this with multiple kinds of albums, but it happens most (as far as I can see) with Mobile Uploads or Instagram albums.
What can cause this?
try /3738185490005/photos?fields=id&limit=100
Even with a valid access_token with right set of permissions, FacebookClient does not get ALL of the photos for given album id
To ADD "user_checkins" to the scope collection to get all of the photos that are in a given album. Please follow the link above.
Strange. I made an app, and nothing like that happened.. For the album that is not hidden to the user, all pics of that album are shown.
To be in the safe side, try using the access token along with the api call.