function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KSusan CoxKSusan Cox 

Access Chat messages in apex class

Hi,

I want to access my Chat messages from my Apex Class. So, I need to access the object of chat message. So If anybody knows how to access the chat message. Please suggest me the solution.

Thanks
Ashish_SFDCAshish_SFDC
Hi , 


Permission required: System Permissions > Manage Chatter Messages
You'll have to clone one of the existing profiles to enable it, and then assign a user to the profile. If you're cloning the Admin profile, keep in mind you'll need an other admin to change your profile to the new profile with manage chatter messages enabled.


In dataloader: 
Log in with a using having the above permission/profile.
you can export, chek "Show all Salesforce objects" and select the Chatter Message object.
In step 3: Edit your query you can enter a query, for instance : "SELECT id, body, ConversationId, SenderId, SentDate from chattermessage"

This will give you an export of all chatter messages. Im at this time not sure how you can see to whom the message is send, I suppose that's in the conversation object.
You could also add a '"where Senderid != 'Chatter Expert user Id' " to your query to filter out all the  default welcome to chatter messages and such.


Regards,
Ashish
alouie_sfdcalouie_sfdc
The ChatterMessage object is for the Private Messages feature in Chatter. It's different than the real-time chat feature, which I think is what you're asking about. The chat feature is not accessible via the API.