General sense of how to do this with Facebook Connect - facebook

I am working on a web site that lets members sign up for classes... and I'd like to implement Facebook Connect in some way so that when someone enrolls in a class, it can pop up a window and say "hey, 12 of your friends are also enrolled!" and show the friends.
I know this is possible, but in looking at the Facebook Connect docs, it's a bit confusing about how to do it.
I don't need specific code or anything like that... but I'd love a general sense of how to do this, or even some rough meta code.
So the answer I'm looking for would be something similar to: "first you need to authenticate the user by calling this facebook api call (link), then that will return their ID, which you need to keep in your app's local database... then you give facebook a list of all the IDs you know, and facebook will build a list of their friends that match, by using this api call (link)" etc...
I just need enough so I can see "the big picture" and then start to actually write some code and string all the pieces together. Facebook has great API docs but sometimes the context of the calls (i.e. WHEN I would use certain calls, and under what circumstances, like this!) is pretty vague.
thanks--
E

Quite simply, once the user has authenticated your application, you store the user's ID in your database. When user is logged in via Connect, you can use Friends.getAppUsers to return a list of users who have also authenticated the application and are also the authenticated user's friends. You could then compare those IDs with the IDs in your database table that stores user IDs and associates them with class IDs (I'm assuming each Class has an ID/table).
Check out the overview on providing social context in the documentation for more: http://wiki.developers.facebook.com/index.php/Connect/Providing_Social_Context

Related

Instagram Graph API getting users geolocation without login and access token

I know that you want to suggest me private api or any scraper. I used them but they don`t return accounts geolocation. In my application I want to get instagram accounts geolocation, likes, comments, followers and follows in order to get engagement of account.
If you say it is not possible look TrendHero website it returns all information about users, followers rank, country information and other handy information which you can find in your insights (in instagram account) without users permissions.
My first impression, without caring to dive deep into the company you linked, is they are simply using scrapers. That's typically how those big contact databases are done.
The Instagram APIs simply don't provide the access they used to. That's how it is. Simply asserting there must be a way doesn't mean there actually is.
#WizKid Instagram can't actually prevent scraping. They just make a little fuss about it.

Storing Facebook Data

I know there have been numerous questions regarding Facebook's policies in which we can store information into our application's database. I have looked at Storing Facebook API data and also have looked at https://developers.facebook.com/policy/ but I just want to ensure that I am not violating Facebook's terms of use. I want to store a user's objectID in order to get certain information about them for use on another screen on my application (namely their profile picture) into my database. I was wondering, is that considered okay? I have looked around and haven't seen anything explicitly speaking about storing a user's objectID so I just wanted to confirm this would be okay. If this is not okay, would any one have any suggestions on how I can get a specific user's profile picture? Thanks!
I believe for Facebook's API things like a user's object ID is actually just an ID for that user for specifically your application. Meaning, you have a unique ID for a user that is completely different than the ID that Facebook uses internally or that another application has for the same user. So unless I terribly misunderstand, you can and should store that.

iPhone App to read Facebook wall

I want to create an iPhone app that displays (among other things) a specific Facebook wall. For a good user experience I didn't want an app that required the user to have a Facebook account and I didn't want to force the user to have to log in to Facebook to see the latest "news" in the app. I started out by getting the wall RSS feed and tried parsing it ... I can "see" all the data I need ... but that is getting complicated quickly and has too many variables that are making the final results less than stellar. I have read through the Facebook iOS programming tutorials and it seems to me like the SDK forces the user log in, which I don't like.
My question ... Is there a way to use the Facebook SDK with hard coded profile credentials to access a specific wall without forcing the user to login? If possible, is that a recommended approach? Any other ways to skin this cat?
I have read through the Facebook tutorial and searched through many postings on this site but haven't found an answer to this ... sorry if this a newbie question and has already been answered.
Item I.2. of the Facebook API policy list says
You must not include functionality that proxies, requests or collects
Facebook usernames or passwords.
It sounds to me like that's what you're proposing to do; i.e., the user will be able to see a certain wall, but using hard coded credentials (not their own). In other words, your credentials are proxying for the user.
I do not know if it is technically possible to do this (I imagine it is) but I don't think it's a good idea, and I do think it's a violation of the Facebook API terms of service.
First you need to get the a access_token by parsing your app id and secret.
https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET
Then send following request to get the data you want. Note that only public data will be accessible.
https://graph.facebook.com/FACEBOOK_USER_ID/?access_token=ACCESS_TOKEN

get a list of people using my facebook application

I want to get a list of all users (even if they are my friends or not) who are using my facebook application. Is this possible? If so, how?
And another quick question if we're still here :) Assue I have a facebook id of a person, can I retrieve his name by using it?
I don't believe that you can get a list of all the Facebook IDs of users of a particular application. There doesn't appear to be a possible query for this based on an examination of the FQL tables, probably due to performance and privacy reasons. Generally the presumption is that you maintain a local list of users in your own application, and correlate them to Facebook via their ID, so you would already have all these IDs.
To answer your second question though, yes, that is definitely possible. The Facebook API provides both the users.getStandardInfo and the users.getInfo methods, both of which take user Ids and return information about the user, including the name. users.getInfo can even be used without a session key to just get the name of the user.

How to crawl Facebook based on friendship information?

I'm a graduate student whose research is complex network. I am working on a project that involves analyzing connections between Facebook users. Is it possible to write a crawler for Facebook based on friendship information?
I looked around but couldn't find any things useful so far. It seems Facebook isn't fond of such activity. Can I rely on the Facebook API?
Update (Jan-08-2010): Thank you very much for the responses. I guess I probably need to contact Facebook directly then. Cheers
Update (Feb-16-2011): A new book, "Mining the social web", just came out. In it, there is a chapter devoted entirely for mining Facebook using Python. Cheers.
You can't rely on the Facebook API unfortunately. To get friend information, you need to use something like friends.get(). However, any Facebook API method that returns user information like this requires that you have an active session key from that user, and generally the way you get an active session key is to have the user come to your Facebook application or page.
In summary, the information you are talking about is essentially private. You can't pick a person from Facebook, get their friends, and get those friend's friends, and so on. To me this is a good thing for privacy, but of course it prevents arbitrary analysis.
I'd throw out the idea of writing a quick and dirty application with some user appeal that you could use for research. If a group like S**t My Dad Says (funny, not really safe for work) can get 120,000 users in a couple of months, you could probably plead your case with a small research application and get a reasonable amount of users.
The problem is that facebook friendship information is typically private and only accessible to friends. It should be a lot easier to build this network on Twitter, if this is an option for you.
As others have stated, this is typically private information. If, however, Facebook per se isn't a requirement, you could use Google's Social API. A snippet from the Google Social Graph API page: "With the Social Graph API, developers can now utilize public connections their users have already created in other web services. It makes information about public connections between people easily available and useful."
Here's an article on using it in Ruby:
http://articles.sitepoint.com/article/google-social-graph-api-ruby-rails#
This lifecode post provide a basic python script to scrape your facebook friends contact info.
The output of this script, is the profile ID, profile pame, profile URL, e-mail address and mobile/phone number (if provided by friend).
WARNING: This is against Facebook TOS. Use at your own risk.
Info provided for educational and research purposes
http://ruel.me/blog/2010/11/26/scrape-your-facebook-friends-contact-info-with-python/
You can use http://www.facebook.com/directory/ to get the public listed people.