Facebook Cookbook - Jay Goldman [33]
Attachments are one of the most underused integration points, so you should think about how to take advantage of the scarcity of attachment options to give your app some good visibility in front of your users. You’ll need two pieces of information in order to enable Attachments for your app: the wording to use as the action (which will appear next to your app’s icon) and a callback URL (which will be loaded in the pop-up window to present the Attachment selection interface). For more information, see http://wiki.developers.facebook.com/index.php/Attachment_Example.
Suggested Hello World value: Leave this blank, since we’re not going to build attachments.
Publish Content to Friends/Self
The Publisher, introduced in the Profile redesign of mid-2008, provides users with a very simple mechanism for publishing content on the Wall tab on their own Profile or their friends’ Profiles. Specify URLs here for the Publishing Action and Callback Action the same way you do with Attachments, discussed earlier.
Suggested Hello World value: Leave this blank, since we’re not going to add Publisher support.
Info
The Info tab, which was also introduced in the Profile redesign, contains information about the user whose Profile you’re browsing. Apps can now populate their info into that tab, either in text-based or object-based formats, and will receive a ping at this URL when users edit the content so they can post-process it (i.e., tokenize and add URLs).
Suggested Hello World value: Leave this blank, since we’re not using the Info features.
Hello World
Problem
OK! I have my new Hello World application set up in the Developers app. Now what?
Solution
You have your app all ready to go, but when you go to your URL (one like http://apps.facebook.com/jays-fantastic-demo), you get a 404 error message (see Setting Up a New App for more about setting up your app). The problem is that you don’t have anything on your server for Facebook to display, so let’s put something there. Make a new blank page in your favorite text editor (see Facebook Developer Software Toolbox for a list) and stick this in it:
Hello
Save the file to your http://yourdomain.com server as index.php, and then reload your new Facebook app.
Discussion
You should now have a fully functional Facebook application that only you can see. Congrats! This app can be used as a great test bed for all of your ideas as you work your way through the rest of this book.
Installing Your App: It’s All About the About Page
Problem
Now that I have an app set up, how do people install it?
Solution
You probably know this already if you’ve ever installed an app, but the general case is that all installation roads lead to your About Page. It’s worth noting that this used to be more true when you had to install an app before you could see any of its content, but it has become slightly less the case now that pages inside an app can be publicly visible. The URL to your application’s About Page will take the form http://www.facebook.com/apps/application.php?id=8653633892 (obviously with your app’s ID rather than the Zerofootprint Calculator’s), which leads to a page profiling your masterwork.
The screenshot in Figure 3-6 shows the About Page for an application that I’ve added and for which I’m a developer. Contrast this with the page for tvClickr (Figure 3-7; see http://www. facebook.com/apps/application.php?id=16534688290), an app I haven’t installed.[5]
In Figure 3-7, you’ll note the big blue “Go to Application” button in the top-right, as well as the absence of the links that would enable me to edit the app’s settings (which are present in Figure 3-6). Clicking on the button takes me to the “Log in to Application” page where I can grant the app access to my information, as shown in Figure 3-8.
Actually adding the application takes me to the post-add URL specified by the developer (see Setting Up a New App for more information).
Figure 3-6. Zerofootprint Calculator