Access rights
You can programmatically control fine-grained access rights for any participant in a conversation. Guests always have full read-write access to a conversation.
Participants can have access to a conversation with one of three different types of access right:
- Full access (
ReadWrite
): The participant can read messages from, and write messages to, other participants. The participant can be listed in the conversation header. - Read-only access (
Read
): The participant can read messages from, but not write messages to, other participants. The participant can be listed in the conversation header. - No access (
None
): The user is not a participant in the conversation. The user cannot read messages from or write messages to the conversation participants. The user cannot be listed in the header of the conversation.
When a participant’s access to a conversation has been withdrawn, they will not receive any new messages. However, they can still access the messages up to the point at which their access was removed. If a participant whose access to a conversation was removed at a later point gets their access back, then they will be able to read the entire conversation history, including all the messages that were sent while they did not have access.
You can change a participant’s access to a conversation directly via the JavaScript Chat SDK. For example:
1const conversation = session.getOrCreateConversation('<CONVERSATION_ID>');2conversation.setParticipant(me);3conversation.setParticipant(other1, { access: 'Read' });4conversation.setParticipant(other2);
The code in the previous example sets one of the participants to read-only. If this user has newly joined, or if the conversation is itself new, then the user will join in read-only mode.
You can change a user’s participation in a conversation through the REST API.
Guests always have full read-write access to a conversation. If you would like guests to have read-only access to a conversation, you can simulate read-only access by hiding the message field.
If you enable guest access for a conversation, anyone who knows the ID of that conversation can enter that conversation as a guest. To control who gets access to a conversation, note that you can use unguessable conversation IDs.