A while ago we set out to make our Content Management System social. We wanted it to talk to us, inform us of information we found useful. We decided to hook up our publishing system to Chatter. Whenever a page you were interested in changed, you would get a notification immediately in your Chatter Feed.
But when we starting working on the Chatter REST API internally, it was hard. Documentation wasn’t easy to find, examples didn’t work for us and functionality didn’t match with the text. To be fair, it was still in development, but we needed it now.
So, instead of letting it go, we wrote our own library – or wrapper if you prefer – in Java around the REST API. We wrote in such a way that it could be easily reused by whoever uses Java and the Chatter REST API.
We made it as easy and versatile as possible, and the end result is so easy anybody can use it. Below is an example of how you would create a connection to your Salesforce.com org and post something to your team’s Chatter wall.
Easy as that! ChatterData holds the credential data, the ChatterService acts as the portal to your org, and you pass it ChatterCommands (defining where the message should go) and Messages.
In the case of our Content Management System, it looks something like this:
This wrapper has recently reached open source status and it is hosted on Github. You can find the library here: https://github.com/forcedotcom/JavaChatterRESTApi.