We have this amazing thing of collaboration inside Salesforce, the Chatter – an amalgamation of best features of Facebook and Twitter.  And to add, it’s for enterprise, so its Enterprise Collaboration Isn’t that awesome!!! Chatter supports lot of things post, comments, likes, follows etc and  best part is its not just user posts, comments etc .. its data posts, comments etc i.e., even the data is part of the collaboration . That adds to awesomeness!

However, there’s been one feature which I been waiting for and always wanted to see which is auto refresh of posts (for techies – ajax refresh) without need to refresh the entire page. Without this feature collaboration doesn’t seems to be complete and web2.0 type.  An alternative to auto refresh can be a stream or ticker (like we have Feed Ticker on facebook) which keeps scrolling and shows posts / comments happening around without need to refresh page.

So I thought of building the same, and first thing I needed was a poller which can poll and see if there are any chatter posts, but that would have been too resource intensive, and would have died after few hours because of governor limits and bla … bla … And to save me, there came a really great feature The Streaming API. I’m loving it!

Two lines about API - Use Streaming API to receive notifications for changes to Salesforce data that match a SOQL query you define in a secure and scalable way. Streaming API is useful when you want notifications to be pushed from the server to the client based on criteria that you define.

So what’s next, I was super excited to get all started to use Streaming API and poll Chatter objects.  I was able to get basic streaming API program working (after few discussions around streaming api with Pat Patterson, as the API had few issues in terms of documentation).

In basic example, I created a PushTopic (a SOQL query that you want notifications about) of Account. Now as the objective is chatter stream, so I tried to create a PushTopic around chatter object, and here was entry of the Villain – PushTopic aren’t supported yet for Chatter objects (SF please enable the same @ earliest)

So what next,  trigger the rescue man came to help. Developed few triggers which will do realtime snapshot of chatter objects, and then created push topic against these snapshot objects.  This way (though indirect way) I will be able to get push notifications (using streaming API)  of chatter posts…wow, finally I made it. I got the CHATTER STREAM or CHATTER TICKER ..

The use case of this is endless,  sky is not the limit..


Road map:

  • The notifications are lost the moment page is reloaded, so will try to add something which makes them persist until user has seen them.
  • Apply Sharing Settings, as currently all messages of  all users are shown

Trust me this idea struck me in morning and by evening the tool/app was ready. Thanks to Rajesh Shah for helping me out in testing this app.


  • Amit Saxena

    Nice work Chirag.

  • http://syncapps.cazoomi.com Clint Wilson

    Good weekend reading Chirag:)

    When our Salesforce.com HootSuite App is finally released by HootSuite I will have your team critique it.


  • Pragya

    Great work Chirag,
    This will provide real time notificaton and we can get to know instantly if someone is making any post.

  • http://blog.superpat.com/ Pat Patterson

    Nice work Chirag, and thanks for the shout out! :-)

  • Rajit Nair

    Great Post Chirag! Streaming API very well used!

  • http://shivasoft.in/blog Jitendra

    Really nice work chirag.. Very Good idea of using Streaming API at this place.

  • http://www.logicbenefit.com Murali Mohan

    An Interesting Article Chirag..Keep the good work going!! Looking forward for inclusion of highlighted Chatter updates for best posts.

  • Angelica

    Excellent article! This is a good example of how Streaming API can be used.
    Keep posting articles like this :)

  • Manu

    And here’s the idea for SF to implement Push Topics for Chatter : https://sites.secure.force.com/success/ideaView?id=08730000000kdnBAAQ

  • http://www.ChiragMehta.info Chirag Mehta

    Thank you, and yes we need streaming api for chatter too so that we can use the same for enabling connections between (other) devices and chatter.

    Also there’s idea for stream or ticker @ https://sites.secure.force.com/success/ideaView?id=08730000000hGOzAAM