Joining and Leaving
Once you set up a group chat, you are able to programmatically add and remove users in a conversation. You can also restrict access rights, turn on/off notifications or set a label for certain people in a conversation.
The user can be a participant of a conversation with 3 different access rights.
- Full access ("ReadWrite"): The user is listed in the header, can read and write messages to other participants.
- Read-only access ("Read"): The user is listed in the header and can only read, but cannot write messages.
- No access anymore ("None"): The user used to be a participant but has since been denied any access by setting
access
to "None". The user is not listed in the header for other participants. The moment this user rejoins, they get all the messages that they might have missed. Until then, they see a static view of the conversation with only the messages that were exchanged until they were removed from the conversation.
You can change someone's access to a conversation immediately via the JS SDK. To continue the example from the previous section:
const conversation = session.getOrCreateConversation('CONVERSATION_ID');conversation.setParticipant(me);conversation.setParticipant(other1, { access: 'Read' });conversation.setParticipant(other2);
var conversation = window.talkSession.getOrCreateConversation('CONVERSATION_ID');conversation.setParticipant(me);conversation.setParticipant(other1, { access: 'Read' });conversation.setParticipant(other2);
The code above sets one of the other participants to read-only. If they're newly joined or if the conversation is brand new, then they will join immediately in read-only mode.
Note that you cannot remove participants from a conversation using the JS SDK, but you can via our REST API.
You can also add, remove or change people's participation in a conversation through the REST API
You can programmatically turn on/off sending fallback notifications for participants of conversations. Read more about notifications.