How To Write A Good Connect Plugin

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Turning Your Site into a Good Connect Site

Check out How To Write A Good Connect App for some ideas about making a successful Facebook Connect site. Your plugin should help Web admins provide a good Connect experience out of the box. As a plugin developer, you should also understand Facebook Connect Fourth Party Code to help ensure that your plugin enables your users and publishers to deeply embed Facebook Connect into their site.

Generating an API Key

We want users to interact directly with the website. After all, if a user logs onto TechCrunch, that user is connecting with TechCrunch, not with Facebook's WordPress Plugin.

That means each admin who installs the plugin needs their own API key. You should provide these admins with the following instructions:

To use Facebook Connect you will first need to get a Facebook API Key:

  1. Visit the Facebook application creation page: http://www.facebook.com/developers/createapp.php
  2. Enter a descriptive name for your blog in the Application Name field. This will be seen by users when they sign up for your site.
  3. Accept the Facebook Terms of Service.
  4. Upload icon and logo images. The icon appears in News Feed stories and the logo appears in the Connect dialog when the user connects with your site.
  5. Click Submit.
  6. Copy the displayed API key and application secret into this form.

Auto-Configuring the Site

Once the admin gives you the API key and secret, your plugin should automatically configure anything else it needs using admin.setAppProperties.

For example, if your plugin wants to be notified whenever a user disconnects their account, you could call this:

$fb->api_client->admin_setAppProperties(array("uninstall_url" => "/path/to/post_remove.php"));


Creating Feed Forms

You can publish to a user's profile using Feed forms. You store the content of the Feed story in a stream attachment. You call the Feed form with FB.Connect.streamPublish.

Configuring Admin Options

If your plugin has an administration panel or configuration file, then you can provide options for modifying the API key, Feed forms, and other site-specific settings.

Here's an example from the WordPress plugin showing what a plugin administration screen may look like:

Image:Wordpress_plugin_config.png


Examples

See the Facebook Connect Plugin Directory for examples of some Facebook Connect fourth-party plugins.