0

I’m trying to get the number of unread feed-elements for a given user, using Chatter API, but I don’t know if there is an easier way to do that.

Last API release includes some information about whether a feed element has beed readByMe or not, so that could give us the number. The downside of it would be to get all feed-elements, which are paginated, and iterate them to read readBy property.

I know there is an endpoint to get a count of unread conversation /connect/communities/communityId/chatter/users/userId/conversations/unread-count but I’m not sure if it is what I want, I don’t know the differences between a feed-element and a conversation. Also, if I try to use this endpoint I get an error:

"You do not have permission to use Chatter Messages. Your organization may >not have permission or may not have enabled Chatter Messages. If you're >in a network, Chatter Messages may not be enabled for the network."

I’ve also tried using /chatter/feeds/record/recordId/feed-elements, however, it's not valid either, because it is for feed groups.

1

The unread conversation endpoint you posted is for private conversations and is very different from a feed.

While there is a readBy capability for a feed element to show whether the context user has read it or not, there is currently no easy way to get the total number of unread feed-elements for a feed, such as a news feed for a user.

Your approach to get all the feed-elements and total up the unread count would work, but it will be very process intensive, especially for a very large feed. It will lightly run up your api call limit very quickly and I would not recommend doing it.

2
  • More or less what we were afraid of. Would you know if we could get that information directly from the database using SOQL? Thank you for answering! Jul 27 '17 at 9:47
  • Unfortunately, no. There is not a field in SOQL to simply retrieve the number of unread posts on a feed for a given user from the database.
    – Alex Wu
    Jul 28 '17 at 17:27

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.