Facebook, OpenSocial – meh. Why aren’t widget useful?
Widgets are a hot topic in the world of social networks and blogs, but at the end of the day they really don’t make our lives better. I mean honestly, if all of those widgets out there stopped would we miss them? Hell, some of them are down right annoying. The IDEA of a widget is not as dumb as some of these apps, but for some reason they haven’t been embraced by those developers that are helping us to get things done.
Google has just released OpenSocial, and I was admittedly pretty excited – for about 5 and a half seconds at which point I realised it would have limited scope outside of the social networking world (hence the name). Why was I excited? Well I would love to be able to create a widget for 88 Miles – imagine being able to drop a time-tracking widget into BaseCamp or NetAccounts or ? Or, even better, into your internal intranet.
OpenSocial has so much potential, but isn’t quite there for the Software as a Service guys, so why don’t we create a an Open Widget API? What do we need? Well, not that much – if we flip the way that OpenSocial works a little and do a little work from the application side.
JavaScript, JSON and HTTP
The easiest way to drop your widget on to a third-party site would be JavaScript. Create a standard JavaScript end-point that the third-party app can retrieve. Maybe it could pass in a element id that you could use to build your DOM tree from. Because the script is hosted on YOUR server, you can make calls back to your server via AJAX. You can use this to generate HTML, make callbacks, retrieve JSON and generally interact with your database.
This is SO easy with Rails, as you can get a JSON REST API out of the box, with very little effort. PHP/Pylons/ASP.NET will do the same thing easily enough to. Extend that idea, and with a little knowlegde of the site you are embedding on, you could probably even interact – add a company to your Basecamp account and it would automatically add it to 88 Miles. You could do it by registering observers of specific types maybe – not sure, will still have to think that bit through.
Authentication
We already have a system for authentication – it’s called OpenID. If your site implements OpenID, it is pretty god-damn trivial to authenticate a user that has already authenticated on the third party site. Any OpenID provider worth it’s wait will remember your credentials once you have logged in – so the third party site can pass your OpenID URL down to the widget, then you can authenticate them from there, and because your provider has already logged you in, you won’t need to enter a username or password.
The ultimate mashup
If all of your favourite apps had these widgets, you could easily drop them in to your intranet site. How kick-arse would that be? What do you think?