How to delete a user from a conversation and add a different user

You can modify an existing conversation by adding and deleting users.

To delete a user from the conversation, you can use the REST API. Use the Leave conversation endpoint to remove the user.

To call the REST API, you will need your app ID and secret key, which you can find in the Settings tab of the TalkJS dashboard. You'll need to call the REST API from a backend server to avoid exposing the secret key.

To add a user, you can use the Join conversation endpoint of the REST API. You can also add a user with the setParticipant method in the JS SDK, or on mobile you can use the corresponding methods in the React Native or Flutter SDKs.

Note that if a new user is added, the user can also see all the chat history from before they were added.