Get most active friends in chat using Facebook FQL - facebook

Is there a way to get what are the most active friends in chat via FQL?

There is no count() method in FQL, so no, not directly. You could query the thread table and then loop through the recipients returned to count it in your own script.
If you look at the new unified_message and related tables in the documentation, it appears that Facebook is adding features to the messaging system. You may be able to do this in the future.

Related

Get the date when two users became friends in php

It's possible to get the date when two users first interacted on Facebook? For example: in a comment, photo tags, wall post, etc. I need this for a FB app since isn't possible to get the date when two users became friends.
Any idea of I can get this done?
I'm thinking in merging a lot of fql queries but don't figured how to do this yet. If I want this for all my friends, isn't gonna be too slow?
It is possible now to extract dates from which you became friends with another user on Facebook. Try it via the API Explorer Tool: https://developers.facebook.com/tools/explorer/?method=GET&path=UID%2Fposts%3Flimit%3D25%26until%3D1342599743
No, unfortunately it is not possible with the API for existing friendships.
But you should be able to use the Real-time updates (https://developers.facebook.com/docs/api/realtime) to be notified when they become friends with someone. Currently the documentation say they support the friends user connection.

Is it possible to do this with fql

Using Facebook's Graph API, I am currently looping through all friends to retrieve their videos, and then present a list of these videos to the user. It obviusly takes a while to do this depending on number of friends,
Is there any way to just say to FQL - give me all videos that I have permsission to view?
Facebook doesn't want applications to be able to "mine data". They don't want applications to be able to collect that much data on anything they want. In most cases an ID must be specified.
User ID
Page ID
Group ID
Event ID
etc...
Even in such a case there is also limitations and multiple calls will have to be made. The limitations themselves are not only limited to accessing data with FQL or the Graph API.
There are also limitations on your access to the API. This is called application throttling and it can be enforced on your application if they find you doing an abnormally large amount of calls to the API. There are also other limitations such as making multiple sequential posts or even duplicate posts to your users.
I'm afraid that the answer is no.
Just playing around with the graph API explorer:
http://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20vid%2C%20owner%2C%20title%2C%20src%20FROM%20video%20WHERE%20owner%3Dme%28%29
I know that to get a list of my friends I can do:
SELECT uid2 FROM friend WHERE uid1=me()
I then updated the video query to:
http://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20vid%2C%20owner%2C%20title%2C%20src%20FROM%20video%20WHERE%20owner%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%3Dme%28%29%29
And now I get a paginated list of all videos belonging to my friends. This one query is certainly better than pounding the API to death with multiple calls. :)

Facebook FQL or graph API events

I'm trying to develop an application wich will get all the facebook events and show it on a iphone application.
My question is what is the best way to retrieve all the public facebook events in PHP. I know there is the FQL and the open graph api but with FQL I cannot retrieve just all the public events and I can't seem to find a way to do this.
Can somebody help me with this ?
Kind regards !
Both FQL and the Graph Api work well. Both are great options.
FQL:
FQL may be faster if you want to get all the events from all a user's
friends.
FQL has a method of getting the count of attendees, maybes,
not attendings, and "no replies" directly, without having to count
yourself, which saves LOTS of time when dealing with 20,000 people
concerts etc. [ IF you want to calculate the gender ratios,
unfortunately then this feature wont help you much ]
FQL has a method of determining who was invited by whom, called "inviter" from the "event_member" table, though it appears to be presently broken: Finding who INVITED you :: Facebook FQL Explorer Bug: "Inviter":null
If you are using FQL, you can use "privacy" to determine if the event is public.
SELECT name, venue, location, start_time FROM event WHERE eid in
(SELECT eid FROM event_member WHERE uid=me())
The Graph:
- You used to check "privacy" for the privacy of an event. It is now depreciated and I believe it doesn't matter now, because only the events you have access to will show up.
$JSON = $facebook->api('/'.$target.'/events?fields=name,venue,location,start_time,description,picture.type(large),attending.fields(gender)&since='.time());
TIP: IF your program should show events for one specific region, can use an app's authentication rather than nag a user to log in and approve your app ( unless you have special customizations for each user).

How to find top friends on facebook

I am trying to develop an application on facebook for which i need those friends with whom the user interacts the most on facebook .In short i need a list of top friends of a user. How can i do that.What parameters do i need to look for in the graph api for finding the top friends.
Facebook doesn't provide this information directly per se but it would be pretty easy to use FQL statements to generate this information yourself. Check out the FQL documentation asn you could run queries against the stream table to find user interactions. You could also look at checkin table and album/photo/photo_tag, although these would require more permissions from the user.

Possible to get Fan Page Update Information via API?

I receive an email once a week with information on my Fan Page (like how many more users than last update have become my fan, how many posts, etc). Is it possible to get this info via the FB API so I can show this data where I want outside FB and outside my email?
One of the way is using fql of facebook :
Group FQL Table
After you can get the group ids, you can use the group_member tables to get all members from that group:
Group Member FQL Table
You can even use Graph API if you want but I am not an expert of that