Browser Synchronization
If you exclusively use the REST API to create or update TalkJS users and conversations then you may want to disable the ability to create or update via the JavaScript SDK. In the TalkJS Dashboard you will see the two checkboxes under the security settings section that allow you to disable synchronization via the browser - one for synchronizing users, and one for synchronizing conversation data.
If user synchronization via the browser is disallowed, the following will not work as it tries to add/update the data via the SDK:
Instead you can reference a Talk.User
using only their ID instead, which will use the details already stored for the user.
const me = new Talk.User(123456);
var me = new Talk.User(123456);
Similarly if the option to disallow conversation synchronization via the browser is checked, the following will not work as it involves modifying the conversation data using the JavaScript SDK:
// Only if the conversation already exists, this will workconst conversation = session.getOrCreateConversation(Talk.oneOnOneId(me, other));// Trying to set a participant via the SDK will cause an errorconversation.setParticipant(me);conversation.setParticipant(other);// Trying to set the the conversation's attributues will also cause an errorconversation.setAttributes({subject: 'Hello world!',});
// Only if the conversation already exists, this will workvar conversation = talkSession.getOrCreateConversation(Talk.oneOnOneId(me, other));// Trying to set a participant via the SDK will cause an errorconversation.setParticipant(me);conversation.setParticipant(other);// Trying to set the the conversation's attributues will also cause an errorconversation.setAttributes({subject: 'Hello world!',});
Check out our tutorial on how to ban a user from all chats that uses Identity Verification together with disabling browser synchronization to ensure integrity of your user's data.