Integration with social media such as Facebook, LinkedIn, YouTube etc is hot. And Uniface is incorrectly perceived as old fashioned. This sample will show that is not difficult at all to integrate Social Media in your Uniface application. And to make it more interesting it shows you how to do that from your classic Uniface desktop application.
Should we integrate these two very different worlds?
Like all other projects this should only depend on the specific business case and nothing else. Maybe your sales manager comes up with the idea that when a user adds a new product to your inventory, that should be automatically communicated to your customers over Twitter and on your Facebook page. If that gives a good expected return on investment it would be foolish not to build that functionality.
Can we integrate these two very different world?
Yes we can, as this sample will show. It will show you how to implement two important parts, the authentication mechanism and the Facebook API, from a Uniface Windows application.
Facebook uses the OAuth 2.0 protocol. That is nice because it is also used by other websites, so we can reuse it. To implement the Facebook authentication in a Windows application you need an embedded browser. In Uniface we can create an embedded browser by using an OCX container with the Microsoft Webbrowser control. We make it navigate to a web page from Facebook. When the user is not logged in to Facebook, first a log in screen is shown, otherwise he/she immediately will be asked to give the application permission to access some of his/her data on Facebook. When the user gives permission the application receives a special key that we need to send with each API call.
The Graph API is the one that we can easily call from Uniface. This API can be implemented in HTTP requests using the Uniface UHTTP component. In this sample we keep it simple, just a simple Uniface Form where you can type a message that will be posted on your Facebook wall.