Control access to group chats

You can control which users can access the chat, and how. This guide shows how to control access permissions for participants and guests, from either your frontend or backend.

Control participant access

Participants can have any of the following types of access permission:

Access typeValueDescription
Full read-writeReadWriteThe participant can read and write messages in the conversation.
Read-onlyReadThe participant can read but not write messages in the conversation.
No accessNoneThe participant can read historical messages up to the point at which they lost access, but can't read or write new messages belonging to the conversation.

You can programmatically control a participant's access permissions to a conversation, either from your frontend or backend.

Control access from your frontend

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.

Control access from your backend

You can change a user’s participation in a conversation through the REST API.

Control guest access

Guests always have full read-write access by default. If you want guests to have read-only access, you can simulate this 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.