I need to retrieve the direct messages sent to a community user using Apex. I found that direct messages stores under "ChatterMessage" Object.

After enabling the system permissions "Manage Chatter Messages and Direct Messages", I am able to do the SOQL on the "ChatterMessage" SObject using Developer Console. But still, it's returning 0 records however I made a couple of direct message at my private community.


1 Answer 1


ChatterMessage object is for private messages.

postFeedElement(communityId, feedElement) is for direct messages.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .