Since Facebook changed their privacy settings last year, I’ve been looking for a way to display public updates – and only my public updates – to the world.
But, of course, Facebook has other ideas. I was at first expecting them to show up on my public profile page, but no; it’s an fully public profile or nothing… and you have to be logged in to Facebook to see it. A Twitter-style lifestream is not on the cards, it seems. And you can’t use RSS feeds either, as they include no privacy information, thus you can’t filter for ‘Everyone’ content.
So, I’ve given up on waiting for Facebook to follow up on the initial ‘Everyone’ noise, & have written a PHP Facebook Platform application to retrieve these public updates myself.
The application is at http://apps.facebook.com/publicstatusfeed// http://www.facebook.com/apps/application.php?id=331369174049. The FB app is just an iframe pointing to the application code on my website, at http://vodex.net/publicstatusfeed/.[1. I'm not allowed to use the word 'Facebook' in the application name, hence the different naming.]
I’ve released the application code at http://code.google.com/p/publicfacebookfeed/. Please note this is in an initial release. There is not much documentation, test cases, or any caching, for example. [2. I'd have liked to try out hosting on GitHub, as that's what all the cool kids are using these days, but frankly, since the hassle of using the FB platform, after yet more mucking around with undocumented GitHub command line intricacies I admit I just decided to be lazy.]
How to use
- Visit http://vodex.net/publicfacebookfeed/ ; you’ll be taken to http://apps.facebook.com/publicstatusfeed/ to grant the application some permissions. Click ‘Allow’ a few times.
- http://vodex.net/publicfacebookfeed/rss.php?uid=YOURFACEBOOKUSERID is now an RSS feed of your public updates!
Whew, that was easy. Note that if you’re not OK with my website accessing your Facebook activity, please download the code & set it up yourself on your own server.
I’ve also put up a human-readable diagnostic page, at http://vodex.net/publicfacebookfeed/core.php?uid=YOURFACEBOOKUSERID. Mine is at http://vodex.net/publicfacebookfeed/core.php?uid=802410391.
How it works
Sadly, I didn’t enjoy developing this – Facebook Platform has a reputation for a volatile API & incomplete documentation. In total, it took me around 12 hours (admittedly spread out over some months of leisure time) for what should have been a reasonably simple task.
I also found a few forum posts etc. of other developers attempting this, but no working applications or real guidance. Perhaps no-one is that interested in this area? Statistically speaking, I find it surprising that I am the first to publicly figure this out.
Anyway, do something similar to the below (or check out the code):
- Your application must request offline_access and read_stream extended permissions.
- When the user authorises, store their session key (MySQL works just fine). These used to be called ‘infinite session keys’.
- The session key allows you to access the user’s content without having to go via the Facebook UI. In the script to actually get the content, create your Facebook client and then set the session key to that which you stored earlier. Do not go through requiring permissions again, as that’d trigger the Facebook UI, which you don’t want if e.g. the server is polling an RSS feed, with no human in sight
- For the content itself, use Stream.get, and not the more obvious (& apparently deprecated) Status.get, as that doesn’t allow querying by privacy. (Hat tip to the Facebook Developer stand at the PHP Conference for this!)
- Get streams for given userID with privacy of ‘EVERYONE’ and then do interesting things with it.
So there we go; I can now finally have public Facebook activity in this site’s lifestream. If there’s interest in this application (i.e. I’m not just scratching my own itch), I’ll look to proceed further with it.