{"id":2451,"date":"2012-04-14T14:19:51","date_gmt":"2012-04-14T09:19:51","guid":{"rendered":"http:\/\/www.chiragmehta.info\/chirag\/?p=2451"},"modified":"2012-04-16T22:27:58","modified_gmt":"2012-04-16T17:27:58","slug":"chatter-stream-or-chatter-ticker","status":"publish","type":"post","link":"https:\/\/www.chiragmehta.info\/chirag\/2012\/04\/14\/chatter-stream-or-chatter-ticker\/","title":{"rendered":"Chatter Stream or Chatter Ticker &#8230;"},"content":{"rendered":"<table border=\"0\">\n<tbody>\n<tr>\n<td width=\"20%\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/photos.weddingbycolor-nocookie.com\/p000003627-m156817-p-photo-410184\/awesome-thumb.jpg\" alt=\"\" width=\"200\" height=\"200\" \/><\/td>\n<td>We have this amazing thing of\u00a0collaboration\u00a0inside Salesforce, <strong>the Chatter<\/strong> &#8211; an\u00a0amalgamation\u00a0of best features of Facebook and Twitter. \u00a0And to add, it&#8217;s for enterprise, so its <strong>Enterprise Collaboration<\/strong> Isn&#8217;t that <em>awesome<\/em>!!! Chatter supports lot of things post, comments, likes, follows etc and \u00a0best part is its not just user posts, comments etc .. its data posts, comments etc i.e., even the data is part of the collaboration\u00a0. That adds to <em>awesomeness<\/em>!<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>However, there&#8217;s been one feature which I been waiting for and always wanted to see which is auto refresh of posts (for techies &#8211; ajax refresh) without need to refresh the entire page. Without this feature\u00a0collaboration doesn&#8217;t seems to be complete and web2.0 type. \u00a0An alternative to auto refresh can be a <strong>stream or ticker<\/strong> (like we have Feed Ticker on facebook) which keeps scrolling and shows posts \/ comments happening around without need to refresh page.<\/p>\n<p>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 &#8230; bla &#8230; And to save me, there came a really great feature <strong>The Streaming API<\/strong>. I&#8217;m loving it!<\/p>\n<p>Two lines about API &#8211;\u00a0Use\u00a0<a href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/api_streaming\/index.htm\" target=\"_blank\">Streaming API<\/a>\u00a0to receive notifications for changes to\u00a0Salesforce\u00a0data that match a\u00a0SOQL\u00a0query you define in a secure and scalable way.\u00a0Streaming API is useful when you want notifications to be pushed from the server to the client based on criteria that you define.<\/p>\n<p>So what&#8217;s next, I was super excited to get all started to use Streaming API and poll Chatter objects. \u00a0I was able to get basic streaming API program working (after few <a href=\"http:\/\/boards.developerforce.com\/t5\/Streaming-API-Developer-Preview\/Error-trying-to-do-the-Visualforce-sample-of-Streaming-Api\/m-p\/360315\" target=\"_blank\">discussions<\/a>\u00a0around streaming api with\u00a0<a id=\"link_20\" target=\"_blank\" href=\"https:\/\/twitter.com\/#!\/metadaddy\" target=\"_self\">Pat Patterson<\/a>, as the API had few issues in terms of documentation).<\/p>\n<table>\n<tbody>\n<tr>\n<td>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 <strong>Villain &#8211; <em>PushTopic aren&#8217;t supported yet for Chatter objects<\/em><\/strong> (SF please enable the same @ earliest)<\/td>\n<td width=\"20%\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/images.meredith.com\/parents\/images\/2010\/01\/ss_101528432.jpg\" alt=\"\" width=\"150\" height=\"150\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>So what next, \u00a0<strong>trigger<\/strong> 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. \u00a0This way (though indirect way) I will be able to get push notifications (using streaming API) \u00a0of chatter posts&#8230;<strong>wow<\/strong>, finally I made it. I got the <strong>CHATTER STREAM or CHATTER TICKER<\/strong> ..<\/p>\n<p>The use case of this is endless, \u00a0sky is not the limit..<\/p>\n<p><a href=\"https:\/\/www.chiragmehta.info\/chirag\/wp-content\/uploads\/2012\/04\/ChatterTicker.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2475\" title=\"ChatterTicker\" src=\"https:\/\/www.chiragmehta.info\/chirag\/wp-content\/uploads\/2012\/04\/ChatterTicker.jpg\" alt=\"ChatterTicker\" width=\"708\" height=\"358\" srcset=\"https:\/\/www.chiragmehta.info\/chirag\/wp-content\/uploads\/2012\/04\/ChatterTicker.jpg 708w, https:\/\/www.chiragmehta.info\/chirag\/wp-content\/uploads\/2012\/04\/ChatterTicker-300x151.jpg 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/p>\n<p>Road map:<\/p>\n<ul>\n<li>The notifications are lost the moment page is reloaded, so will try to add something which makes them persist until user has seen them.<\/li>\n<li>Apply Sharing Settings, as currently all messages of \u00a0all users\u00a0are shown<\/li>\n<\/ul>\n<p>Trust me this idea struck me in morning and by evening the tool\/app was ready.\u00a0Thanks to Rajesh Shah for helping me out in testing this app.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have this amazing thing of\u00a0collaboration\u00a0inside Salesforce, the Chatter &#8211; an\u00a0amalgamation\u00a0of best features of Facebook and Twitter. \u00a0And to add, it&#8217;s for enterprise, so its Enterprise Collaboration Isn&#8217;t that awesome!!! Chatter supports lot of things post, comments, likes, follows etc and \u00a0best part is its not just user posts, comments etc .. its data posts, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-2451","post","type-post","status-publish","format-standard","hentry","category-salesforce","post-preview"],"_links":{"self":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/comments?post=2451"}],"version-history":[{"count":46,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2451\/revisions"}],"predecessor-version":[{"id":2500,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2451\/revisions\/2500"}],"wp:attachment":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/media?parent=2451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/categories?post=2451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/tags?post=2451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}