I need to retrieve direct message data from the customer community plus user profile. How to query direct message object from the customer community plus profile? Thanks, Prasad
The REST endpoints to work with the Direct Message feature are written in a manner to to get the feed for one particular Direct Message. There is no rest endpoint to get all DMs in a network. So, SOQL queries run by a user with "Manage Chatter Messages and Direct Messages" user perm is the way to query for all DMs. The sample query below would be the way to do it. I will point out that this query only gives the initial Post that starts a particular Direct Message thread. When other people respond on that original DM Post, they are chatter Comments. So, that query is not going to get all the Direct Message comments. You would have to run a similar query on FeedComment.
SELECT Title, Body, CommentCount, CreatedById, CreatedDate, Visibility, IsDeleted, NetworkScope, ParentId, Status, Type FROM FeedItem WHERE createdDate = THIS_WEEK AND NetworkScope = 'AllNetworks' AND (ParentId >= '05y000000000000' AND ParentId <= '05yzzzzzzzzzzzz') ORDER BY createdDate DESC
So you should be able to query 'Direct Messages' of community through 'Workbench' with the 'FeedItem' object as long as the user running the query has the perm specified above
Please review Moderate Flagged Direct Messages in Your Community and Direct Message Limitations to learn more about Direct Messages