Guests

TalkJS supports a lightweight access mode to a conversation called "Guest Access". It is a different concept from a Participant. A guest does not become a member of a conversation, does not get email/sms notifications and chats are not added to the Conversation List in the Inbox UI. Once a guest closes the TalkJS UI, they are "unlinked" from the conversation they were viewing as guests. Unlike a participant, they are not counted towards lifetime participant limits of a chat. This opens up few use cases such as the ones described below.

Use cases

Supervisor inspection in real time

Opening a conversation as guest enables a supervisor or arbiter to join a chat without disturbing its flow. The Guest's Inbox will stay clean, because conversations will not be added into the conversation list. Guests are able to follow the conversation in real time, and also write messages.

Super group chats

This case is covered in our guide for Super Group Chats. Guest access lets you join many more users than participant based chats.

Using Guest Access

If you want to use Guest Access for your chat rooms, you need to enable Browser Synchronization in the TalkJS Dashboard as shown on the image below.

Disallow synchronization controls in TalkJS Dashboard

You also need to pass an extra parameter to the select method to enable people to join as guests. Note that you shouldn't use the conversation.setParticipant method here, as that will promote the user to a participant of that conversation.

const conversation = session.getOrCreateConversation('my_conversation_id');
const chatbox = session.createChatbox();
chatbox.select(conversation, { asGuest: true });

Note: If you do call setParticipant on a user, that user can't join that conversation as a guest anymore until they're removed from the conversation via REST API first. In that case, specifying asGuest: true has no effect.

Permissions

Guests have full read-write access to a conversation, so if you enabled Browser Synchronization as described above, anyone can enter a conversation that they know the ID of.

We intend to build a more fine-grained permission system in the future. Until then, you can simulate read-only access by hiding the message field.

Note that you can use unguessable conversation IDs to control who gets access to a conversation, even with browser synchronization enabled.