Get inviter for an event in facebook API - facebook

I have an application and I obtain the list of events for the current logged in user.
I can get the creator of the event but I just can't figure out how can I obtain the user who invited me to a certain event.
Sometimes the creator is not the same as the inviter. Already attending guests can invite other people.
Can I get this info using the facebook API?

Good question and nice-to-have feature but I think the actual Facebook API doesn't allow you to get that information.
The information you can get, about an event:
Graph API: http://developers.facebook.com/docs/reference/api/event/
FQL: http://developers.facebook.com/docs/reference/fql/event/
You could eventually use a "trick" like opening the event page in an iFrame or a popup. Then, with javascript or jQuery get the html contents of that iframe/popup and then get the part that says "FriendName invited you". FriendName = First and last name (+link to profile) of the inviter... It's a dirty solution and probably facebook has some security checks that won't allow this, but maybe it works, let me know ;)

Facebook added a new feature which will achieve what you are looking for. Event_Member's "Inviter" in Facebook's FQL will show you who the inviter is.

You can use FQL for that like:
SELECT inviter FROM event_member WHERE eid=146509188851970 AND uid=me()
You can see the example here:
Graph Explorer
Just remember to change the id of the event.

Related

How to get the facebook user id that likes my website (not a facebook site)

I am making a raffle within the people that had make an "I like" to a certain article of my external website (non facebook). In order to choose the winner I need to know who has made the I like.
This query:
https://api.facebook.com/method/fql.query?query=select%20like_count%20from%20link_stat%20where%20url='myWEBSITE'&format=json
Only get me the total count of I Likes but not the users ID
This query is perfect:
https://api.facebook.com/method/fql.query?query=SELECT%20user_id%20FROM%20like%20WHERE%20object_id%3D%MY_object_ID&access_token=MY_ACCESS_TOKEN
But how do I get an OBJECTID for an external url??
Thanks in advance
Object can be any thing like video, note, link, photo, or album but can not be any FB page or Url.. So I guess its not possible to get the user Id for a URL.
If you are using JS SDK / Like plugin in your website to like it, i think you can subscribe to an event and then use some ajax calls to get those userIds whenever they instantly like it.
See Somnath Muluk's answer in https://stackoverflow.com/a/13467793/269521

Finding recent Facebook friends

How to find my recently added Facebook friends using Facebook application via fql or graph API?
Try this in the graph API tool:
SELECT created_time, description
FROM stream
WHERE source_id = me() AND type = 8
LIMIT 100
Ok, as its 30 days it's going to be a little harder. You need to parse the users home page (http://graph.facebook.com/feed?access_token=xxx).
Once you have that you'll need to look for the story tag where the user add's a new friend. You can get the new friends details from that. The wall feed goes very far back just FYI so you'll need to handle the time as well.
I think you are trying to make an application like Facebook Mapper.
This application is a very useful application for those who want to retrieve the facebook friends.
You can use it for access to a facebook profile. There is a chrome extension for the same. This is named as [Facebook Mapper Chrome][1]
Hope this will help you

Get Facebook Link Likes

Using the Facebook API with the FQL language, how can I get a list of the users that liked a given URL? I got the URL and want to query Facebook to see how many people and what users liked that URL.
Using PHP or ASP.Net... doesn't matter, just want to know how to write the FQL query.
Sadly this data isn't available. What's possible via the Link Graph API objects and the link FQL table is just retrieving a given instance in which a link was shared by a user. You can get the count of likes on a user's posting of a link, but this likely isn't what you want.
Discussed this 3-6 months ago with guys at Facebook, and the consensus then was also that getting this data via API is impossible. As far as I know things haven't changed, and there are some privacy arguments for keeping this data out of the API.
'SELECT user_id FROM like WHERE object_id IN (SELECT link_id from link WHERE url = 'YOUR URL HERE' AND owner = 'YOUR USER ID HERE' '
Like FQL Table
Link FQL table
In order to access user's likes, the application needs to have user_likes permission from the user. After that if you access http://graph.facebook.com/me/likes with appropriate access tokens, all the object IDs (including external websites), the current user has liked will be listed.
(this is in reply to bounty question, which seems a bit different from the original question asked on this page)
It's not using FQL but...you can see the most recent 500 users that have like your page by going to: https://www.facebook.com/browse/?type=page_fans&page_id={id} but you would have to scrape this to get the information and it won't work for more people besides the most recent 500. Here's the gotcha, you've gotta be an admin of the page_id to see it.
You can only get the fans of pages that you are an administrator for. So you have to provide an access token with your request associated with an admin account of the page you are trying to get the fans.
Facebook's FQL documentation here: https://developers.facebook.com/docs/reference/fql/page/ tells you how to do it. Run the example SELECT name, fan_count FROM page WHERE page_id = 19292868552 and replace the page_id number with your page's id number and it will return the page name and the fan count.

Where is the Facebook Status feed URL these days?

I know that it was previously possible to display your most recent Facebook statuses on your website as an RSS feed, but it seems they've changed their setup and I can't figure out where to find the feed anymore....
I saw some people searching for this a while ago, but since Facebook just released their new layout, I didn't know if this might have changed again.
Any help would be greatly appreciated.
Try this for a feed in JSON-format.
http://graph.facebook.com/[uid]/feed
Facebook appears to have killed all the public status feeds in the name of user privacy. The only way to fetch it is to build a facebook application that gets your status updates, and then associating your facebook account with that application to give it permission to access your status updates so it can put them somewhere else.
Thankfully, someone has already done that for us. Just go to http://apps.facebook.com/statusexport/ while logged in to facebook and grant the app permission. Then it will give you a public URL to an RSS feed of your status updates.
Just keep it simple... This is an easy way to load your latest status(es) using graph.facebook.com through curl / php. Includes a quick simple function.
Easiest way to load your latest facebook status
I found this site which you authenticate, and it will then give you a working rss feed.
I have found that it does have some limitations, but you can see it here:
http://www.fbrss.com
If you wan't to display status updates only, you can use:
https://graph.facebook.com/[uid]/posts
This URL will return a JSON string of user [uid]:s status updates.
To get your status feed, follow these instructions:
Log into Facebook
Go to http://www.facebook.com/notifications.php
Click the link titled "Your Notifications" at the bottom of the box to the right of the list of notifications
That will bring you to a feed of your notifications, which is not what you asked for. This url will be something like feed://www.facebook.com/feeds/notifications.php?id=XXXXXX&viewer= XXXXXX&key=YYYYYYYY&format=rss20
Change notifications.php to status.php in the URL (preserving all the URL parameters).
That should be a feed of your status updates.
Start at http://www.facebook.com/notes.php and click on the "My Friend's Notes" link. Change the friends_notes part of the url to friends_status, and you should be good to go.
Programmatically specifying user to query status updates for
(Note: This is a server-side solution)
It's possible the feed you're looking for has been deprecated for security purposes.
Alternatively facebook FQL on the Status table might provide an answer because it allows you to specify the user ID (for example, your own) for which to retrieve status updates, and a time frame can be specified to limit them as desired.
A raw fb FQL query example, for status updates:
select uid,status_id,message
from status
where uid in
(select uid2 from friend where uid1= uid)
AND time > {time in the last week}
The main FQL guide starts here.
Sample
Poking around the Internet you can pick up sample code of FQL code being called from PHP and other platforms.
PHP example:
<?php
$q = "SELECT name FROM user WHERE uid='$id'";
$query = $facebook->api_client->fql_query($q);
?>
The facebook client API library for your platform of choice can be downloaded and used to issue FQL statements.
--
There is also a Test Console hosted online for facebook developers to test API statements against their own account.
You can also use a RSS feed generator for your Facebook Statuses (or Photos) like the RSS Feeds application on Facebook.
It will help you generate a RSS feed for all your statuses and photos while maintaining the privacy modes.
Although, I am not a fan of the user interface the application has, but the functionality is what is awesome :)
Theres also anther way to do it..Which is simple and easy...its not an rss feed but a plugin can be developed to output as an rss...Theres a tutorial of it on http://Fourgefeed.com

What is the API for Facebook 'profile stream' aka wall posts?

Is there an API call, and if so, which call to get the 'posts to my wall from myself and others' on Facebook? It seems like it could be filtered out of the Facebook stream API, but it's not clear how that works to me.
This link seems to imply it's possible:
http://developers.facebook.com/news.php?blog=1&story=225
You want to do an FQL query like this:
SELECT actor_id, message FROM stream WHERE source_id = <user id> limit 50
You will probably want to select a few more fields, you can see what is available here: http://wiki.developers.facebook.com/index.php/Stream_%28FQL%29
Here it is.
Profile feed (Wall): https://graph.facebook.com/me/feed?access_token=...
https://developers.facebook.com/blog/post/465
You can publish stories to people who like your Open Graph Page the same way you write a Facebook post from your own wall. The stories appear in the News Feeds of people who have clicked the Like button on the Open Graph Page.
You can also publish using our API. If you associate your Open Graph Page with a Facebook app using the fb:app_id meta tag, you can publish updates to the users who have liked your pages via the Graph API.
First you need to get an access token for your app.
Check out the blog post, it covers everything you need.