Documentation

Chat and Platform Profile Connection

Overview

If the client's users have profiles on the main platform where chats are integrated, they can be linked. In this case, the authorisation process in a chat will be avoided, and users can join the chat right after their main authorisation with their main nicknames and avatars.

For this approach, you must activate the feature through the admin panel and choose an integration type: postmessage or GET.

PostMessage Integration (Recommended)

When a user clicks the "Open Profile" button or on an avatar, a postMessage will be sent containing the following data:

{
  "type": "social",
  "body": {
    "action": "open_profile",
    "data": {
      "user_id": "double_encrypted_userId"
    }
  }
}

Upon receiving this message, you need to decrypt the user_id twice to retrieve the original user ID (if necessary) and then open the user profile on your side.

GET Parameter Link Integration

When opening a WebView or Iframe, you should include a new GET parameter that specifies the profile URL to be opened. The parameter should be URL-encoded and designed to open with target=_blank.

ParameterDescription
profileurlURL-encoded URL that will be opened

Example

Here’s how to open the WebView or Iframe:

[https://chat.watchers.io?roomId=](https://chat.watchers.io/?roomId=){ROOM ID}&userID={ENCRYPTED USERID}&apike={APIKEY}&profileurl=https%3A%2F%2Fwww.watchers.io%2Fprofile_name_or_id

This setting enables you to directly link to external profiles within your chat interface, providing a seamless user experience.