GrandCentral Facebook App

Well, I took advantage of a low-hanging fruit, and wrote my first public Facebook app yesterday. My Picasaweb app is still in the works, but this appeared to be a bit more simple, as I would only have to deal with the Facebook API on this one, rather than the Google API as well. The concept is simple – you copy the code generated from your “Call Me” button generated from GrandCentral into a text box after you add the App to Facebook. The app then converts that embeded swf into FBML and sends it to your Facebook Profile for others to see.

The app itself wasn’t that hard once I got over the learning curve. The basics of the Facebook API are to generate a session key with canvas->validate_sig(), and then pull the session key parameter from the returned parameter hash to be passed through forms, used in a cookie, etc. Then on every page you need to access Facebook data (such as sending fbml to the user’s profile) you just run session_key(), passing in your session key you retrieved with validate_sig() on the entry page.

I also used this app as an opportunity to learn Perl’s Catalyst Framework, the Ruby on Rails of Perl. I will definitely be using this more in my web apps in the future – maybe even in some of my non-web apps (one advantage it has over RoR – it’s very flexible). The basics were I just run a simple command to create the basic Catalyst framework files and libs, then create my Database Model files and run a command to generate the libraries for that, including DBIx::Class ties. Then I just create my Controller libraries with a simple command, and then my TTSite (Template Toolkit libraries and files) libraries with another command. I’m then free to edit and write as I please, and it forces the code into a modularized structure. I used Perl’s WWW::Facebook::API libraries to access the Facebook API – once I figured out the session stuff everything else was very easy.

The one quirk I’m still trying to get around is Facebook forces you to click on an swf before it gets activated when it’s on a user’s Profile page. You’re supposed to be able to display an image in it’s place, but I’ve only been able to get that to work on the Canvas pages. The tag for that is , btw. I think I’m going to sniff httpd to see what that swf is doing behind the scenes to see if I can find a non-swf way of doing the call me button.

If anyone has issues in particular with either the GrandCentral App or WWW::Facebook::API, feel free to list your questions below. Also, please add my app and give comments! The url is:

http://www.facebook.com/apps/application.php?api_key=a5438e29c1b4df4ec650d374b4175741

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s