Last week I spent some time learning how to build Bebo applications. Their API is just like the Facebook API but it is not complete and the documentation has some holes in it. If you haven't built a Facebook application the entire process can seem awkward.
The Bebo Developer Page makes it sound like a simple 3 step process
- Get the library
- Install the app
- Start Creating.
If you don't know how to write web applications in PHP, Java or Ruby stop now. You need to know at least one of these systems to continue.
I downloaded the PHP library and put it on my host. Next step was to install the developer application. Why? Why do I need to install an app to build apps? Seems weird at 1st but basically this application is used to manage the keys, locations and settings for your apps.
Once you have the app launch it and click "Create new app" (way off on the right) . Give your application a name and a URL and a callback URL.
What is the callback URL? It is the URL that is hit when a user goes to the Application URL. http://apps.bebo.com/yourappname is just a proxy that adds headers and parameters to the request before it hits your application file. The bebo library uses this information.
For example. I created an app called sample with a URL of http://apps.bebo.com/sample. My callback URL is http://bebo.tonycode.com/apps/sample
Hitting http://apps.bebo.com/sample results in a call to http://bebo.tonycode.com/apps/sample where I have the following index.php
This application simply prints out all your friends.
Add the application to your page by going to the developer application, viewing the app and clicking the profile page for the app. Now go to your profile page a voila.. the app is there but not your friends.
Huh? How do I get the content to show up on my profile page? If I don't show it on the profile page it seems pretty pointless. right?
To add content to the profile page you use profile_setFBML. Last I checked the return codes for this function are not defined. Seems to return a 1 when it works and an array when it fails. Nice. :-\
Here is the code updated to put friends on profile too.
Weeks go by and you add new friends to your profile and you notice that the list of friends in your custom application aren't changing. profile_setFBML is only called when you visit the application page. Well that stinks you say. How can I make it update each time I visit the profile? I'll get to that in my next post.
- Documentation is at http://developer.bebo.com/documentation.html
- The downloaded libraries have example code. Start there
- You may need to look at 2 different sections to piece together how a function works. For example user.getInfo has a fields parameter
- Look at the SNQL users table to find what is available