Facebook Pages
From Facebook Developers Wiki
Facebook Pages expand the social graph by enabling businesses to have a presence on Facebook, giving developers access to more users than ever before. Think of a Facebook Page as something like a Facebook profile, only for entities like a business, a band or artist, or a product or even a brand.
Developers can create all-new business-focused applications, partner with businesses to build applications, or simply make the applications they’ve already built for users available for Facebook Pages. The same apps can work on both Facebook user profiles and Facebook Pages, meaning that developers don’t need to do extra work to support Facebook Pages. Read more about Facebook Ads.
Contents |
[edit] Application Configuration
- All applications marked as such in the application configuration can be added by both users and pages.
- Application developers indicate what type of entity (user or Page) can add the application to their Facebook accounts.
- This configuration option shows up on the application configuration page: http://www.facebook.com/developers/editapp.php?edit&app_id=YOUR_APP_ID.
- The default configuration for applications is to work only on user profiles. Developers must change this setting to indicate that their applications are ready to support Pages.
- You must edit your application settings twice. The first time to check the button to allow pages to add the app. Then save, then edit settings again to enter the edit page URL.
[edit] Adding an app/Logging In
Applications can be added by users just as they are today.
When a Page adds an application, the Page administrator is not automatically logged into the application. The application has permission to access and modify information about the Page without an active session.
When a Page removes an application, Facebook sends an fb_sig_page_id parameter instead of fb_sig_user. The fb_sig_page_id is the ID of the Page that has removed the app.
You are encouraged not to force the Page admin to login to the application, as this will improve the experience of the admin. For more information, please see Canvas Pages below.
Please note that actions that appear to be taken by a page are actually taken by one of the Page's admins on behalf of the Page.
Insert non-formatted text hereImage:Example.jpgMedia:Example.ogglink titleBold textItalic text--1002392177 05:29, 18 June 2008 (PDT)==Page IDs== All Page IDs are 64 bit IDs. Note that because user IDs were 32 bits (now 64 bits), you may need to update your underlying storage to make sure it can handle 64 bits.
[edit] Canvas Pages
Canvas pages would work the same way that they do for users right now. Regarding canvas pages for Pages, you are encouraged to pass the fb_page_id querystring in all urls pointing to canvas pages so that we know what Page you are dealing with and can send you some additional information. The following will be sent if the fb_page_id querystring is specified:
- fb_sig_is_admin - is the logged-in user an admin of the Page?
- fb_sig_is_fan - is the logged-in user a fan of the Page?
- fb_sig_page_added = has the Page added the app?
When Facebook needs to steer a Page admin to the correct canvas page for one of the Pages the admin administers, Facebook will point her to http://apps.facebook.com/YOUR_DIRECTORY_NAME/?fb_page_id=PAGE_ID.
[edit] "Profile" Pages
Is there a way to make the url for a page given it's uid? I can link to the admin's page editing page with http://www.facebook.com/pages/edit/?id=[PAGE UID] but I don't know how to make a url for showing the page.
You may link to a page given its id by treating the id like a user id - that is, call http://www.facebook.com/profile.php?id=[PAGE UID]
...aka actually doing anything useful with apps on pages. Since there is no documentation on how to actually modify the "profile" box for the pages, I've copied an (edited) transcript from IRC where I explain how to do it, from what I've gleaned from what documentation there is, and my own experimentation. It may be ugly, but it's way better than anything else out there (aka nothing), and I'm too tired right now to do anything else. Enjoy. --42904324 03:28, 23 April 2008 (PDT)
Here's a very short version, with the basics. Below is the fuller transcript with more background and details.
(02:50:57 AM) fiveofoh: Looks like you specify a settings page
(02:51:20 AM) fiveofoh: Which gets passed a fb_page_id parameter
(02:51:24 AM) fiveofoh: And then you use that in setFBML
(02:52:01 AM) fiveofoh: instead of the UID
(02:52:05 AM) fiveofoh: I just tested it, and it worked
(02:53:13 AM) fiveofoh: It requires a good bit of refactoring of the various parts of your app that assume they're getting a UID
(02:53:18 AM) fiveofoh: But that's the basic idea
(02:53:49 AM) fiveofoh: Somewhere in the settings pages for your app is a Page Edit URL
(02:54:08 AM) fiveofoh: The box on the page will have an "Edit" link that will take you to that page, with a fb_page_id parameter
(02:55:32 AM) fiveofoh: So at the edit URL, you check for the fb_page_id parameter
(02:56:04 AM) fiveofoh: If it's there, you show a page settings page, and then set the box with setFBML, using the fb_page_id instead of uid
(02:56:28 AM) fiveofoh: You need to detect the fb_page_id and make any adjustments necessary
(02:58:17 AM) fiveofoh: if fb_page_id is in the params, give them a settings page that controls what's in their profile box, and a button that
triggers a setFBML with the fb_page_id
(02:58:26 AM) fiveofoh: Otherwise do normal stuff
(02:58:39 AM) fiveofoh: Also, if fb_page_id is in the params, don't make them log in
(02:58:42 AM) fiveofoh: Cause that's obnoxious
(02:58:49 AM) fiveofoh: And unnecessary
(03:00:23 AM) fiveofoh: The page is your user
(03:01:20 AM) fiveofoh: fb_page_id IS your uid for the page
(03:01:35 AM) fiveofoh: Instead of calling setFBML(uid, blah, blah, blah)
(03:01:48 AM) fiveofoh: just call setFBML(fb_page_id, blah, blah, blah)
(full transcript)
(01:48:33 AM) swombat: pom pom pom... do I need to do anything special to set the FBML on a Page (as opposed to a profile)?
(01:48:44 AM) swombat: If so, what?
(01:56:07 AM) swombat: anyone?
(01:56:16 AM) swombat: I've read the wiki, but as usual it's confusing
(02:31:53 AM) swombat: seriously... is there anyone around who knows how to add a profile box to a Facebook Page?
(02:36:33 AM) fiveofoh: I'm trying to remember where I was reading about how to do it
(02:36:41 AM) fiveofoh: Cause I was going to try with mine
(02:42:12 AM) fiveofoh: http://wiki.developers.facebook.com/index.php/Facebook_Pages
(02:42:14 AM) fiveofoh: That's about all they have
(02:44:41 AM) swombat: yeah i've seen that
(02:44:46 AM) swombat: doesn't say how to set the FBML though
(02:44:56 AM) swombat: profileFBML obviously doesn't do it
(02:46:05 AM) ***fiveofoh created a page, there's nothing obvious
(02:49:12 AM) fiveofoh: Hmm, you specify a settings page
(02:49:24 AM) swombat: last Wall post: Thierry Droz (Montreal, QC) wrote
(02:49:24 AM) swombat: at 9:22am
(02:49:24 AM) swombat: There is no help here. Nobody from Facebook has been working on pages application since February...
(02:49:33 AM) swombat: ......
(02:50:53 AM) fiveofoh: Aha
(02:50:57 AM) fiveofoh: Looks like you specify a settings page
(02:51:20 AM) fiveofoh: Which gets passed a fb_page_id parameter
(02:51:24 AM) fiveofoh: And then you use that in setFBML
(02:52:01 AM) fiveofoh: instead of the UID
(02:52:05 AM) fiveofoh: I just tested it, and it worked
(02:52:10 AM) fiveofoh: And btw you can use your app page as a page
(02:52:16 AM) fiveofoh: You can add apps to your app page now :P
(02:52:16 AM) swombat: hmm
(02:52:25 AM) fiveofoh: So you could add a little sample box of your app to your app about page
(02:53:13 AM) fiveofoh: It requires a good bit of refactoring of the various parts of your app that assume they're getting a UID
(02:53:18 AM) fiveofoh: But that's the basic idea
(02:53:49 AM) fiveofoh: Somewhere in the settings pages for your app is a Page Edit URL
(02:54:08 AM) fiveofoh: The box on the page will have an "Edit" link that will take you to that page, with a fb_page_id parameter
(02:55:32 AM) fiveofoh: So at the edit URL, you check for the fb_page_id parameter
(02:56:04 AM) fiveofoh: If it's there, you show a page settings page, and then set the box with setFBML, using the fb_page_id instead of uid
(02:56:28 AM) fiveofoh: You need to detect the fb_page_id and make any adjustments necessary
(02:58:17 AM) fiveofoh: if fb_page_id is in the params, give them a settings page that controls what's in their profile box, and a button that
triggers a setFBML with the fb_page_id
(02:58:26 AM) fiveofoh: Otherwise do normal stuff
(02:58:39 AM) fiveofoh: Also, if fb_page_id is in the params, don't make them log in
(02:58:42 AM) fiveofoh: Cause that's obnoxious
(02:58:49 AM) fiveofoh: And unnecessary
---------------
(03:00:07 AM) fiveofoh: So, you update it periodically then?
(03:00:21 AM) swombat: atm i have it updated on certain user actions and every 30 minutes
(03:00:23 AM) fiveofoh: And wait...the page is your user
(03:01:07 AM) swombat: but... you get both an fb_page_id and an uid right?
(03:01:11 AM) fiveofoh: NO
(03:01:20 AM) fiveofoh: fb_page_id IS your uid for the page
(03:01:35 AM) fiveofoh: Instead of calling setFBML(uid, blah, blah, blah)
(03:01:48 AM) fiveofoh: just call setFBML(fb_page_id, blah, blah, blah)
(03:01:50 AM) fiveofoh: voila
(03:02:02 AM) swombat: ok, so basically, "Facebook pages is all transparent uses fbml blah blah blah" "Oh but btw you need to build a completely
different piece of code to handle this new type of user"
(03:02:18 AM) swombat: (not angry at you btw :-P)
(03:02:43 AM) fiveofoh: Yeah pretty much
(03:02:46 AM) swombat: this sounds really quite tedious and error-prone though
(03:02:50 AM) fiveofoh: Yeah it does
(03:02:56 AM) fiveofoh: Which is why I haven't done it on my app yet :P
(03:04:23 AM) swombat: so, facebook pages for devs: 1) undocumented, 2) overlaps with existing concepts and objects, 3) requires duplication and
alterations to existing code, 4) users need to take multiple complex actions to be able to fully add the box to their page
(03:04:28 AM) swombat: brilliant
(03:05:13 AM) fiveofoh: You'd just do a check for fb_page_id in your post-add page
(03:05:20 AM) fiveofoh: Once again, messy duplication
(03:06:03 AM) fiveofoh: What I might end up doing is if I see fb_page_id, just forward to a separate page, so it's not all gross and duplicated
and ugly
(03:06:27 AM) swombat: hmm
(03:06:36 AM) fiveofoh: like at the top of index.php
(03:06:49 AM) fiveofoh: check for fb_page_id, if so, forward to index_page.php?pageid=blah
(03:07:05 AM) ***fiveofoh considers cleaning up and putting up this IRC transcript on the wiki
(03:07:15 AM) swombat: yeah that sounds like a good idea
(03:08:10 AM) swombat: this is what I'd call a half-assed feature :-P
(03:08:15 AM) swombat: facebook -1
