when will be best time to pull Facebook friends? - iphone

For my iPhone app, an user can logged in using Facebook, then the app can get list of friends that already on the app. Now I am wondering - when should the user's Facebook friends be pulled down. Should it be the time when the user start using the app and login with Facebook? Or should it be done periodically in the background thread? Or should it actually be done on my apps' web service side (with the access token received and sent over from the iPhone app) What's the best practice to go with?
The main concerns are
total # of friends could be a large number, which would require a lot of network traffic
time processing

A couple of options:
From your comments below your question, cache friends lists for a minimum of 24 hours. Friend listings rarely change often (unless the user is under 25 years of age, then it might change more frequently...statistically speaking).
Another option you can also subscribe to a user using the Real Time API. Store their friend information on your server and when Facebook tells you they've added a new friend you add it to your data store. Then you can query your own server rather that hitting the Graph API.

Related

Can a Facebook app post the same message at the same time on 100K users connected to it?

I am developing a web App for users who want to post the exact same thing on a given time on their own Facebook wall to make a message viral. Of course, considering they granted my app the permission to do so and signed up specifically for that matter. Also, the frequency of such a blast message would be rare, no more than once or twice a week.
I would like to know if anyone has any experience in doing this and what the limitations are since I can't find them on Facebook's developer support.
This type of behavior is discouraged by the Facebook ToS. Further, in order to publish to a user's feed you need to have a current access token for that user. If they are currently connected and using your app, you have access to those tokens and publishing should be possible but very well might get your app banned for ToS violation.

Facebook app users notifications

I'm wondering, is it possible to notify every user of a Facebook app?
This is what I would like to do:
Let's say I have a Facebook app with 20 000 users and there is new content in the app. Is it possible to send out a message, wall post, notification, .. to each and every user to let them know there is new content without being banned by Facebook?
grtz,
bundy
You can track all the users (and their friends) by id who view the app. If you have prompted the user for the app to allowing posts/sharing etc you can post to users and their friends walls usin those ids. However there is a limit (My account got blocked for a couple of days for for sending approx 600 "Shares", by mistake ..logic error that kept posting... and the app was in sandbox mode, so the rules still apply)
So to answer the question, I would say No. not by wall posts/shares, but you could collect their email address and send them a mail externally with a link to the app.
My experience of FB is using the javascript api to create notifications and posts, I am not sure of the limits in this api and do get confused between "feeds", "Shares", "Notifications" etc... FB is not quite an exact science, it would seem.

Stats based on Access Token?

My app stores the Facebook Access Token for offline use. The main purpose of the app is to allow users to automatically posts on the walls of people within a specified number of days of their friends birthday.
My app has been blocked by Facebook due to spam (some users are sending marketing messages to their friends instead of using the app for it's purpose).
I want to find out who those users are and block their access to my application. The only problem is that my Facebook App has a few hundred access tokens (one for each user of my application). The insights dashboard does not provide me with stats per access token. I need to find out which of my users are getting their wall posts reported as spam.
Is there any way of doing this?
After appealing, Facebook has unblocked my application but I don't want it to happen again. As far as I can tell, I can find out the number of people who have reported the wall posts as spam...but I don't know which access token made those posts...and hence don't know which of my users is posting spam messages.
It's not Facebook job to keep track of your application internal activities. You should be logging every activity, at least posts ids returned when someone posts anything on their friends' wall.
And one more time... you DON'T need the offline_access permission to publish something when the user is offline!

Outside access to Facebook events

Let's say I own/control a Facebook page where events are posted. I'd like to display these events on another website (In my case, a WordPress blog, but that's not the important part) on an "Upcoming events" page.
What I'm unsure about is: Is the Facebook API usable "externally" like this? I've downloaded the PHP library and have a demo app running that works from within Facebook (i.e. emitting FBML that facebook.com interprets and displays to the logged-in user), but in my case I want a third party (my web server) to query Facebook every so often, rather than the site visitors directly requesting data (HTML/JSON/etc.) from Facebook itself.
Is this sort of thing possible with the Facebook API? How will my web server authenticate itself? What information do I have to store?
Note: I'm looking for information more at a "sequence diagram" conceptual level, not just asking for code. That part I can figure out myself. ;) Unfortunately, Google and the FB developer wiki have not been entirely forthcoming. What do I need to know so I can start coding?
This is a basic overview of how I've done it for a few of my clients who wanted similar functionality:
Create a pretty basic app that prompts for Extended permissions, specifically "offline_access" and whatever else you need
Store the resulting Session Key in your database with the UID
Create a secure, authenticated webservice for your app which allows you to get the info you need for a UID that you supply, using the session that you've stored in your database
On the website make requests to your app's webservice, being sure to cache the results for a certain period of time and only make a new request to your webservice once the cache has expired (I use 5-10 minutes for most of mine)
So basically your Facebook app acts sort of like a proxy between the website and the user, doing all of the authenticating and requesting using legitimate means.
I've used a webservice because I only wanted to maintain one Facebook app for multiple client's needs. It works like this (in a not-very-awesome ASCII art diagram):
Facebook User 1 \ / Client Website 1
Facebook User 2 --- Facebook App --- Client Website 2
Facebook User 3 / \ Client Website 3
Note: I've only done this for users, not pages, so your mileage may vary.
You can do Events.get with the Facebook API then supply the page/profile ID you'd like to get the events for. Depending on how your page is setup you may have to authenticate, simply use your Facebook account, since you should have access to all the events. oh and make sure you do plenty of caching so your not hitting Facebook on every page load.
AFAIK other than user info, you can't fetch any other data from facebook.
But you can try it other way - say create an app that stores events and other relevant information on a webserver and then your other website can easily access that info.

How to display a list of Facebook users registered with my Facebook Connect website

I'm developing a website using Facebook Connect as the only membership/authentication mechanism.
So far authentication and inviting friends work.
Now I'd like to display a list of users registered with my Facebook application. Something like : "There are 1234 members in the AppName community" + a list of profile pictures.
How would I do that ?
Thanks !
This is actually pretty easy to do. After each user connects with your site through Facebook Connect, create an entry for them in some user table (which you're probably already doing). Then when a user logs in simply display the total number from your users table and randomly select 10 user IDs (or whatever number of pictures you want to display) and show them using the FBML <fb:profile_pic> tag http://wiki.developers.facebook.com/index.php/Fb:profile-pic.
There is some metric information available about your application via the Admin.getMetrics API call. I believe it only provides the number of active users within a certain time period however.
The actual total number of users is difficult to track due to people who remove the application, or might have it installed but blocked. I don't think it's available as a specific property anywhere. The information pages about Facebook apps never show the total number of users, only the monthly active users, which is what Admin.getMetrics() can tell you.