Ghost posting on FB.ui streams

We had a bit of an issue when launching our app a few weeks ago. Everything was working fine on our test apps, but when live, all the stream messages we posted (we call them "Sharings") had a random text appended.

Most of the time it was a generic Facebook text, but sometimes it was a creepier SQL request just displayed plain on the user feed.

The Facebook text was (for the sake of search engine goodness):

Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, upload an unlimited number of photos, post links and videos, and learn more about the people they meet.

As the issue only occurs in production mode and never on any of our test environments, this was pretty difficult to debug.

Here was the code used to post the Sharing :

FB.ui({
  [...],
  'title' : 'Title of the Sharing',
  'caption' : 'Text of the Sharing'
});

As I later found out, the captionkey is not supposed to hold the Sharing text. The descriptionkey should be used for that. I'm not exactly sure was captionwas for, but it seems that if you let the descriptionkey empty, then Facebook fills it automatically with a placeholder text.

The solution simply was to put the text in the descriptiontext, and leaving the captionkey empty :

FB.ui({
  'title' : 'Title of the Sharing',
  'caption' : '',
  'description' : 'Text of the Sharing'
});

As this behaviour is counter-intuitive, undocumented and random, I think posting it here could help other lost souls like me.


Tags : #description #feed #caption #stream #javascript #fb-ui #facebook

Want to add something ? Feel free to get in touch on Twitter : @pixelastic

Search