0

I am creating a chatter based custom application and wants to display Trending chatter posts based on the activity around that Post (Likes, Comments etc.)

I couldn't find any Method/API exposed by SF to do it in a standard manner.

Available Workaround so far

  1. Search for Trending Topics and search for related posts. Connect API has a Trending Topic method

But if post is not related to any topic, I won't find it.

  1. Search for All posts and then sort them based on Number of comments and Likes. However this approach won't work once number of posts start growing.
0

Hi Salesforcesmarty,

   You can do one internal callout and get the trending topics. 

As suggested here: https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_topics_trending.htm

As per winter 16 release you will not be hitting api limits. Ref: http://docs.releasenotes.salesforce.com/en-us/winter16/release-notes/rn_apex_internal_callouts.htm

Make Unlimited Concurrent Callouts to Internal Salesforce URLs

You can now make unlimited concurrent callouts to endpoints in your Salesforce org’s domain. You no longer need to live in fear of hitting limits when you set up cross-org integrations to synchronize data between your orgs. You can also make unlimited callouts back into your own org to access the Metadata API, use describeLayout(), and so on.

| improve this answer | |
  • If you read my question properly, I have already mentioned this approach in the post. This will fail, if my post is not related to any topic. – Salesforcesmarty Dec 14 '15 at 3:16
  • @Salesforcesmarty Ohh..I need to do more R&D thanks for pointing out. If I find anything. I will get back to you. – Kiran Machhewar Dec 14 '15 at 3:18
  • @Salesforcesmarty You can use a soql on FeedItem as "SELECT Id,CommentCount,LikeCount,Body FROM FeedItem Order By LastModifiedDate DESC, CommentCount DESC, LikeCount DESC LIMIT 100". Since here we are fetching only limited number of trending topics so query shouldn't be giving problem. Also you are getting latest updated, having max number of comments followed by like count. Do you see any problem here? – Kiran Machhewar Dec 14 '15 at 4:08
  • This is what I tried as my second approach, however if you like a comment for a post, post won't show up in your query. – Salesforcesmarty Dec 14 '15 at 4:12
  • Also, if I query the Feeditem I am not getting PhotoURL for the user, I will have to separately query them using connect API. – Salesforcesmarty Dec 14 '15 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.