Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Back to HTTP API.
Note: The Alfresco Facebook integration is an example implementation and is unsupported.
Web ScriptsWeb 2.0
Social ComputingFacebook
Alfresco Modules
Note: Alfresco community member, Jeff Potts, created an excellent Screencast of the integration and how it works.
Content-oriented Facebook Applications may now easily be developed using the Alfresco platform. This means that enterprise content management capabilities can be mixed with the social graph of Facebook.
An Alfresco Facebook Application is developed using the Web Script Framework which has been extended to support Facebook capabilities. Java, compilation and all those other hard-core development activities are not required; just scripting.
The quickest way to learn how to build an Alfresco Facebook Application is to dive right in. We'll build the obligatory 'Hello World' application, but with a friendly twist.
none|450px|Developer Application
From within the Facebook 'Developer' Application...
A simple convention is followed when developing Alfresco Facebook Applications for specifying the above URLs. For a Canvas Page URL of <x>, the Callback URL is http[s]://<host>:<port>/alfresco/facebook/<x>/ where <host> and <port> refer to your hosted installation of Alfresco.
NOTE: Facebook requires a unique Canvas Page URL. If building this application, you may have to find a unique canvas page URL of your own.
none|450px|Installation Options
none|450px|Created Application
At this point, a new Application has been registered with Facebook. There are three values you need to take note of:
It's time to tell Alfresco about our new Facebook application.
This is where our three Facebook application values come into play.
Create a file called app.<API Key>.js whose content is:
app.id='<Application id>';
app.secret='<Secret>';
none|450px|Application Content
'Hello Friends' is a very simple one page application. It presents a Hello message from all your Facebook friends.
Each page of your Facebook Application is implemented as a Web Script. For our simple application we'll implement a Web Script for the Canvas Page URL we registered with Facebook (in this case /facebook/alfhello/). The Web Script renders FBML (Facebook Markup Language).
<webscript>
<shortname>Hello Friends</shortname>
<url>/facebook/alfhello/</url>
<format default='fbml'/>
<authentication>user</authentication>
</webscript>
none|450px|Web Script Description
This registers the Web Script against the Facebook Canvas Page URL. Facebook always POSTS when rendering FBML. Also notice the default format is fbml, a new pre-registered Web Script format for Facebook.
Hello from
<fb:name uid='${friend}'/>facebook available in all Facebook Web Scripts.
Of course, the usual Alfresco Web Script goodies are also available, so it's easy to perform content management within Facebook.
That's it. Time to test.
none|450px|Web Script Template
The Web Script Framework has been extended to support Facebook Application development.
Facebook authentication is handled automatically by the Web Script framework. A user cannot access an Alfresco Facebook application until they have logged in. Facebook is responsible for authenticating, but once authenticated, Web Scripts execute as the Facebook user. This means the Alfresco user id is inherited from the Facebook user id (an integer). All Alfresco operations performed by that user are recorded under the Facebook user id, including 'created by' and 'modified by'.
A new facebook root object is available to both Javascript and Freemarker Templates within Facebook Web Scripts.
A root object allowing interaction with the Facebook Server.
Note: The intention is to provide all Facebook REST API calls via the facebook root object. Contributions to this area are welcome.
The Alfresco Document Library demonstrates a more complex real-life content-oriented Facebook application. It's essentially Facebook Photos, but for Documents. The sample application is available in the AMP file named 'alfresco-fb-doclib.amp', where the complete Web Script source code is provided. This source code is now managed on Google Code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.