You need to sign in to do that
Don't have an account?

"Invalid user identifiers" when sending chatter message to portal user from apex
I have in my code: ConnectApi.ChatterMessages.sendMessage('Hello World', '[portal user id]');
But it fails saying "Invalid user identifiers"
This is a community user. Does that mean they can't receive direct chatter messages? This same piece of code works fine for internal users.
But it fails saying "Invalid user identifiers"
This is a community user. Does that mean they can't receive direct chatter messages? This same piece of code works fine for internal users.
Something like this:
ConnectApi.ChatterMessages.sendMessage('community id','Hello World', '[portal user id]');
Reference: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ConnectAPI_ChatterMessages_static_methods.htm#apex_ConnectAPI_ChatterMessages_sendMessage_2
Do we have to unable Chatter Messages for the community.
Anybody have any idea or solution about that case. Why the message is not sending to community user through chatter rest api?
Anyone has any clue what could be the cause?
OptionsDirectMessagesEnabled and OptionsPrivateMessagesEnabled
The first one is what you can setup in the Community Setting, but the second one is not in the UI and is the one that allow you to send Chatter Messages to Communities Users. You can query them using the Workbench:
SELECT Id, Name,OptionsDirectMessagesEnabled,OptionsPrivateMessagesEnabled FROM Network
Now... How can we turn on this setup? I could do it making a PATCH over the record:
/services/data/v30.0/sobjects/Network/[NETWORK_ID]
{"OptionsPrivateMessagesEnabled":true}
Then, you will able to send Private Messages using ConnectApi.ChatterMessages.sendMessage. Take in consideration that there is not standard component in Community for Private Messages, so you will have to develop a custom one.
Regards