Control guest access

Guest access offers a light-weight way for users to access a conversation. Guest access is a great option for large public group chats, where you might not want users to be @mentioned or to receive notifications about missed messages. Check out Participant access and guest access for a complete overview of guest access.

Enable guest access

To allow users to join a group chat as a guest, you need to enable guest access for that conversation.

To enable people to join a group chat as guests, take the following steps:

  1. Login to your TalkJS dashboard and go to the Settings tab. Under Security settings, enable browser synchronization of users and conversations by unchecking the following two boxes:
  • Disallow user synchronization via the browser
  • Disallow conversation synchronization via the browser

Unchecking these boxes ensures that data on both users and conversations can be updated via the JavaScript SDK.

  1. In the code where you use the select method to select the active conversation, pass an extra asGuest parameter:
1const conversation = session.conversation('<CONVERSATION_ID>');
2const chatbox = session.createChatbox();
3chatbox.select(conversation, { asGuest: true });

You now have guest access to a group chat enabled.

Note: Users can't join a conversation as a guest if they're already a participant. Specifying asGuest: true has no effect when a user is already a participant of a conversation.

If you would like to switch a current conversation participant’s access type to that of guest, then first delete their "Participant" using conversation.participant(session.currentUser).delete(), then select the conversation as a guest.

Turn off guest access

A guest never becomes a member of a group chat in the first place, and so you can't remove an individual guest from a group chat.

You can, however, turn off guest access completely. To turn off guest access, take the following steps:

  1. Login to your TalkJS dashboard and go to the Settings tab. Under Security settings, disallow browser synchronization of users and conversations by selecting the following two boxes:
  • Disallow user synchronization via the browser
  • Disallow conversation synchronization via the browser

Selecting these boxes ensures that data on both users and conversations can't be updated via the JavaScript SDK.

  1. In the code where you use the select method to select the active conversation, remove the extra asGuest parameter.

You now have turned off guest access to the group chat. With guest access turned off, users won't be able to join this conversation as a guest.