How to add facebook friends searchbar in website - facebook

I am learning facebook php and javascript sdk. I am trying to create a facebook search friend bar in my app where user types friends name and as user types, the searchbar should display most appropriate result while user is typing. Similar to what facebook search bar does. Is there a social plugin or any other tool available to acieve this task? To achieve this, I tried facebook comments plugin with user_friends permission. When user writes any friends name followed by # sign on comments field, facebook gives most appropriate result. But I dont know how to get what user wrote on comments. Any pointers will be helpful.

FB introduced API versoining. If you are going to create new app it will use version v2 and you will not get full friends list from me/friends.
/me/friends returns the user's friends who are also using your app
In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app. In v1.0, the response included all of a person's friends.There are two key use cases where apps need access to non-app friends: tagging and inviting. In v2.0, we've added the Taggable Friends API and the Invitable Friends API to support these flows.After a person has logged in with v2.0 of Facebook Login, calling /v1.0/me/friends and/v2.0/me/friends` will both result in the v2.0 behaviour - both calls will return the set of the person's friends who also use the app.
Read this documentation
https://developers.facebook.com/docs/apps/upgrading

Either you can create this by yourself (not too much of complex). You have access to the friendlist, so you can get all the friends with /me/friends. You can store them (their name/info) into a variable in your application and implement search. This will make your facebook api concepts better.
Or there are many friend selectors plugin/codes that you can integrate in your application. But you'll have to modify them accordingly since you dont want to show a pre-populated list of friends instead you want to implement search.
I've used mbrevoort's multi-friend selector in my applications.
But if you just want to implement search, implementing on your own would be really easy and less complicated!

Related

Facebook API - Friend List

I searched the internet the whole day for this, and came to the conclusion that there is no way to get a user's full friend list since API 2.0 (correct me if I am wrong).
What I want to do is, given the app user and another facebook user, generate a report about their "second level" mutual friends. That is - (friends of mine) who are friends with (a friend of his). Illustration:
Is this kind of thing possible after facebook's restriction since API 2.0 in any platform (Different SDKs, Facebook's Graph API, etc)?
Many Thanks.
This would be the API: https://developers.facebook.com/docs/graph-api/reference/user-context/all_mutual_friends
There is no way to get friends (or users in general) who did not authorize your App. Every list you get will only include users who authorized your App.

How can I uniquely Identify facebook user

How can I get the global facebook link
https://www.facebook.com/5
using v2.2 of facebook API,
Actually my application needs facebook friends and their globally unique facebook ID, I am thinking to get the friend names using taggable API but how can I get the unique facebook ID? or it is not possible at all ?
If somehow I get this global link for a user, I can extract the global ID
https://www.facebook.com/5
(I know its not possible using their API directly, but there must be some workaround that one can use)
Since v2.0 of the Graph API, you can´t get the global ID or the global link anymore for privacy reasons. You can only get App Scoped IDs, but those are unique in one App and good enough to detect returning users. Also, you can´t get ALL friends anymore, for anything else than tagging or inviting (which is only available for games with a Facebook Canvas implementation). No App should know about users who don´t even use the App.
taggable_friends is for tagging friends only, you are not allowed to use it for anything else and you would need to get it approved by Facebook before going public anyway. And there is no way you would get it approved for anything else.

The appropriate usage of the API : `/me/taggable_friends`

With v2.0 in effect, the API /me/friends is now limited to the list of friends that have authorized our app. So, this wont help if I need the complete list of my friends.
But facebook also have added a new API /me/taggable_friends that we can use in order to generate stories that have friends tagged in them, even those friends don't use our app. And if we want to use the taggable friends API, the app will require review.
So, before sending for review I want to make sure that will my app be approved or not? I'm confused since-
the documentation says-
use in order to generate stories that have friends tagged in them;
this answer by facebook product manager mentioned that-
should only be used for the case where you're rendering a list of friends in order to let the user tag them in a post
So I want to know in which scenarios we can use this API that complies with its rules and will be approved when sent for review. For using the OG Actions, of-course it will work (also mentioned in the doc), but will it be approved if-
the an app is just displaying the list the friends and their profile pics. No story, nothing; or
if an app is uploading a photo using /me/photos and tagging the selected friends using the tags parameter. (there's no info of tags parameter in the documentation of /me/photos but it exists).
I'm just asking this to make sure that it will be approved or not before making too many changes.
The guidelines for OG tagging can be found here:
https://developers.facebook.com/docs/opengraph/submission-process#actioncapabilities-actiontagging
Without the context of your action is hard to say if it's acceptable without the user seeing the story and understanding the situation. If you had a bowling app that allowed people to tag their friends while they were all bowling together And no configurable story and the story generated was something like "Bowling with XXX". I think that would be acceptable...
Attaching a story to your OG Story would be another capability as part of Story configuration. Tags would apply to the OG story and the photo.
If you want to upload a photo outside of the OG story you need to look at Photo Upload permissions.

How to use Facebook api to search for users

As the title says i want to search with Facebook Api (Graph Api or FQL, that doesnt matter, or even REST) for users.
For example: I want to search for "Britney Spears" and i want to get all users with that name (like %search%).
The result should be like http://www.facebook.com/search/results.php?q=britney%20spears&init=quick&tas=0.8058435615324403&type=users
you can use the search API from the Graph API for a particular user like this:
People: https://graph.facebook.com/search?q=USER_NAME&type=user
If you want to search for a list of users, you can you this:
SELECT uid, username, name, pic_square FROM user WHERE contains("Joe Biden")
Refer official user table docs to see all the fields you can query
But the CONTAINS() function is known to be mysterious and no one from facebook has clarified it yet. It might work in some cases and others it might not.
see thread: Documentation for CONTAINS() in FQL?
I guess the final answer would be that you cannot replicate the facebook search functionality like the site does (searching all users of a given name). You can only search users related to the current logged in user who is using your app since these are the type of social apps that facebook wants developers to build. They want you building apps that provide value to their users by utilizing their social graph of their friends and relatives. Developers don't need site wise search for this I suppose, hence there is no API to do this (yet).

possible to fetch #mentions thru Facebook API (like thru Twitter API?)

I'm looking to implement a feature where I am able to collect #mentions through the facebook API in a similar fashion to the twitter API.
Specifically, if I run a group called foo, and other people on facebook mention #foo in their wall posts, I'd like to fetch and collect the text of that particular #foo mention.
I can't find any relevant documentation on Facebook....
I think you cant do this, the privacy policy on Facebook is much tougher than Twitter. Even application which being installed need to explicitly ask for permission to read wall posts. if your application has read_stream permission from user then you can read his/her wall posts with API, and you can search for your group name there.