Developing an app for your brand page is not the most difficult part. However, over the years and successive updates, the process has become increasingly cumbersome. Especially since the official documentation is often out of date and search engines offer articles that are quite old and therefore obsolete, making them difficult to find online. Here are some tips and tricks that, I hope, will save you time…
Forget FBML, live the IFRAME Apps!
Announced since the end of 2010, the death of FBML is inexorably approaching and will take place this year (https://developers.facebook.com/blog/post/568/).
Since the beginning of 2012, the language is no longer supported, nor are any possible bugs fixed.
Since March 18th, it is no longer possible to create an application based on FBML; only IFRAME-type apps can be created. However, existing applications continue to work.
June 1st, 2012: Complete and final shutdown of FBML. All existing applications that have not been migrated will no longer work.
Required secure navigation!
For a developer, the use of IFRAME offers some advantages:
Possibility to use javascript libraries (jQuery!) without restrictions
Possibility to manage your application page from A to Z: content management, events, dynamics, and all the technologies used.
An IFRAME is simply a frame that calls up a URL (hosted on your own server, alongside your other pages, websites, or applications); the possibilities are almost endless and the constraints minimal. However, be sure to properly configure and install an SSL certificate for your application URL. Since January 2011, the social network has offered its users the option to browse entirely in HTTPS (a setting in the privacy options). If you do not plan for secure access to your page, then the affected users will receive warning messages, or even error messages depending on the browsers.
LE B.A-BA: the variable signed_request
From a slightly more technical point of view, in order to develop your IFRAME-type tab, it is imperative to know how to manage the «signed_request» variable (https://developers.facebook.com/docs/authentication/signed_request/). This variable is posted by Facebook as soon as someone accesses your application, via a «tab page» or directly (canvas page). It is an encrypted string that you will have to decode on the server side in order to process the information (json structure) it contains.
In this way, you will be able to easily see, for example, whether the person who is displaying your app likes your page or not.
The official documentation details the steps in PHP; I’ll show you how to do this in Coldfusion in a few lines of code:
In the end, we get a CF structure like this:
In addition to the visitor ID, there are 2 or 3 essential pieces of information:
The presence (or absence) of the variable « oath_token » indicates whether the user is properly authenticated and has accepted the application.
The presence of the «page» structure indicates that the application is indeed intended to be launched from a Facebook page and from that page («id»).
The page[« liked »] itself indicates whether the page is «liked» or not. It is therefore very easy to adapt its content accordingly.
Managing authentication: example of an outdated doc (at the time of publishing this article)
If there is one part that can give you a headache, it is the (new) authentication management. In fact, after conducting numerous tests, it turns out that the documentation currently offered on the Facebook developers site is outdated (https://developers.facebook.com/docs/authentication/pagetab/). And as I announced in the introduction, when searching for information on the web, you will only find examples based on these techniques.
Authentication URLs of the type
https://www.facebook.com/dialog/oauth/?client_id=YOUR_APP_ID&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fpages%2Fnull%2FPAGE_ID%2Fapp_YOUR_APP_ID
&scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES
No longer working.
Instead, you will have to use this URL:
<script type="text/javascript">
var _url="https://graph.facebook.com/oauth/authorize?client_id="
+ encodeURIComponent('YOUR_APP_ID')
+ "&redirect_uri=" + encodeURIComponent("YOUR_APP_URL")
+ "&scope=email";
top.location.href = _url;
</script>
Don’t forget to use top.location.href to exit your IFRAME.
Naturally, this article is far from being exhaustive. I am simply trying to point out some tips and highlight some difficulties you might encounter.
If you have special needs for social CRM/Facebook applications, I strongly recommend that you contact us (http://www.NSP-fr.com), we would be happy to collaborate and help you with your efforts.
Respond to this article by leaving a comment, share it with your friends and acquaintances, and sign up for our RSS feed to be informed as soon as new articles are published.



