How to: Friendica’s Facebook connector - adamhesim/friendica GitHub Wiki

1) Configuring the Facebook connector as a user

Note: Special admin instructions are in the second part this document. The first section is for all users.

The Facebook connector is an addon which allows you to interact with friends on Facebook from within Friendica. It is a very powerful feature – because it works in both directions. You can post to Facebook and see the comments your Facebook friends make, and you can see your Facebook friends’ own threads and comments from Friendica, too.

It’s almost as if your Facebook contacts had become Friendica users themselves. And you don’t even have to configure contacts separately – your entire Facebook friend list imported, and updated if new friends are added.

Activating the Facebook connector for your user account

Assuming that your admin has installed the Facebook connector, it can be enabled by going to Settings > Connector Settings > Facebook Connector Settings. When you use it for the first time, you will be taken to Facebook for confirmation.

Configuring the Facebook connector (Facebook side)

Enter your Facebook user name and password and let the application (the connector) do everything the options suggest.

While on the Facebook side of things, also figure out who should be able to see posts from Friendica to Facebook – a fairly sound suggestion would be your Facebook friends. This setting only takes effect when your Friendica post is public – not when you post to a private group you have defined in Friendica.

So assuming you accept the above suggestion, a public Friendica post would now also go to all your friends on Facebook (but needn't, if you don't want it to - more on that later).

But a Friendica post to a group that includes just two Facebook friends would only be visible to those two friends on Facebook (and anyone else who is in the group, Friendica or Diaspora users etc.).

Configuring the Facebook connector (Friendica side)

Once you have clicked okay on Facebook, you will be returned to the Friendica configuration panel for the connector.

Facebook config panel

There are four options here. The first two concern integration of your Facebook friends:

  1. Post to Facebook by default – If you select this, all your public posts from Friendica will also go to Facebook. If you don’t select it, your public posts will ignore your Facebook contacts. But whichever default behaviour you opt for can be changed on a per post basis by toggling the privacy settings in Friendica's post editor. NOTE: Posts to private groups that you have defined and which include Facebook contacts will always go to those contacts, regardless of what you select here.

  2. Link all your Facebook friends and conversations on this website – You will most probably want to tick this one in order to see what your Facebook friends are doing from within Friendica (the connector usually doesn’t make much sense without it).

The next two options concern your own Facebook wall.

  1. Check On this website your Facebook profile wall conversations will only be visible to you, if you want to see your own Facebook posts (meaning the ones you publish on Facebook itself or send there via another connector) in your Friendica stream, along with comments from your Facebook friends. You will then see that content personally, but others on Friendica won’t be able to (they will only see the posts you issue from Friendica). For most people, this is a sensible option to check (more about that in a moment).

  2. Do not import your Facebook profile wall conversations – Activating this option means that no one – not even you – will see the conversations you initiate on Facebook itself. In this case, a post you publish on Facebook will simply stay on Facebook and won't be integrated in Friendica. Most people will probably want to leave this option unchecked.

Activating neither of those two options means that your Facebook profile wall will be merged with your profile wall on Friendica – and your privacy settings on Friendica will be used to determine who may see the conversations.

This can be very annoying to your contacts in some cases!

Example: If you are cross-posting a lot using other connectors, a Friendica post may go to your blog on Wordpress. Perhaps you have a Wordpress plugin that then sends it to Facebook automatically, too. But when it is published on Facebook that way, Friendica will treat it as a separate post – and your contacts on Friendica will probably see two identical versions of it within a short space of time (possibly along with huge pix or video links). This kind of duplication will irritate some and confuse others – and entertain almost no one. ;)

Removing or re-authenticating the Facebook connector

To remove the Facebook connector, click the appropriate link on its settings page. There is also a link there to re-authenticate the connector with Facebook. This is necessary whenever your Facebook password is changed.

Status updates

Status updates from your Facebook friends will arrive once an hour. Comments you make to Facebook or posts you send there usually appear there within one or two minutes.

If the site admin has activated the real-time option for the Facebook connector, many things will work much faster. Specifically, anything that is visible on your own Facebook wall becomes almost instantly visible on Friendica, too: threads you start over there, comments you make, mentions/tags etc.

Contact updates

The Facebook connector polls Facebook once a day to discover whether you have any new friends there – or have lost any.

Note: Some of the public servers have been forced to switch advanced Facebook connection options off, because they are too resource-intensive on sites with many users. This means that you will often get even better and faster Facebook connectivity by hosting your own Friendica site - as the resource problems do not occur on small, private servers. Additionally, you might enjoy the fun of creating your own icon for your Friendica bridge, if you are so inclined.

2) Installing the Facebook connector on your own site (for admins only)

If you run your own Friendica site, you will have to work a little harder to establish Facebook connectivity. But the steps are actually very simple.

Become a Facebook developer

First of all, you need to be a Facebook member yourself. Then, you need to become a Facebook developer. That might strike you as strange, because you’re not actually developing anything, but that’s the way it is. Facebook views the connector as a Facebook app you have developed and are registering.

Here’s where to go to become a Facebook developer: http://developers.facebook.com/

In the course of this process, you will be able to use your standard Facebook identity (name and password), but will be asked to provide additional verification by giving Facebook a credit card or mobile phone number.

This doesn’t mean that Facebook is going to charge you any money.

It does mean that Facebook now knows one more thing about you. Many Friendica admins consider their mobile phone numbers less secret and sensitive than their credit card numbers.

Register the Friendica connector as an app

What the Facebook connector needs in order to work is an App ID and an App Secret. When Facebook gives you these at the end of the registration process, you will be copying them to the connector’s administration panel in Friendica.

To get these codes, you create a new application on the Facebook developers’ site and give it a nice name like My Friendica Bridge. You needn’t give it a name space and you don’t need web hosting for it, so you can leave those two fields blank when the first dialog box appears.

At the top of the application page you see next, you can assign an icon and a logo to the application. Use http://your-friendica-site/images/friendica-16.png for the icon and http://your-friendica-site/images/friendica-128.png for the logo (inserting the address for your own site).

You also need to enter your email address and the address for your Friendica site. Setting the type of application to web site, simply enter the address with a trailing slash: http://your-friendica-site/

When you have confirmed and saved all your entries, you will be given the desired App ID and _App Secret.

Configure the plugin on Friendica

Friendica now gives you a convenient admin panel for the plugin, so you no longer need to edit .htconfig.php manually, as formerly necessary and possibly prescribed in your help files.

All you need to do is go to your Administration settings and visit the Plugins. Click to activate the Facebook Connector, then click on its name to configure it. (If there is no Facebook Plugin listed, you need to download it first from friendica Addons.) You’ll see the two fields where you can enter the App ID and App Secret you have just received. Copy them to those fields and hit Save.

At this point, it’s a very good idea to Activate Real-Time Updates to get Facebook posts as they happen. If you don’t, the default Facebook poll interval is one hour. (This interval can be decreased, but that would affect system resources dramatically and could make the system un-useable depending on the number of Facebook streams/items to process. With real-time updates, system resource usage will be significantly lower overall.)

As an admin, you also have the option of checking the box to "synchronize comments" - which pertains to the problem of comments occasionally getting missed by the connector. On a private server for yourself and a few friends or family members, you can safely activate this option with no further considerations.

Now, all members of your site can use the Facebook connector as described in the first sections of this document.

This applies to you, too! While you have now activated the plugin for your site, you haven’t yet activated it for yourself as a user. Follow the steps at the beginning of this document to do that.


Restricting use

A plugin called Facebook Restrict can drastically help save resources on public and community sites with modest server specs. From the moment it is installed, new users will be able to use the Facebook connector to post to Facebook - but will be unable to integrate their Facebook contacts in their Friendica stream. Members already enjoying full Facebook integration are not affected by this.

There's an easy workaround if you wish to give a new user full Facebook connection privileges at a later date: Arrange to meet via chat (or on the phone) and disable Facebook Restrict for a moment while the user gets his or her connector re-configured. Then reactivate the plugin.


For public/community servers only

If you are running a public server with many users, you should consider using the lockfile mechanism for your poller before switching the comment synchronization feature on. A lockfile protects you against the problem of having multiple copies of poller.php running. Since that phenomenon could corrupt your database, and can be caused by a large number of Facebook contacts being polled, a lockfile constitutes a very sensible measure. To implement it, decide which directory it should reside in. It should be a directory that is writeable by the web server (e.g. /var/www/friendica ). Then add a line like this to .htconfig.php:

$a->config['system']['lockpath'] = "/path/to/lockfile";

So, if you use /var/www/friendica, it would be:

($a->config['system']['lockpath'] = "/var/www/friendica";