Open a chat
Last updated
Was this helpful?
Last updated
Was this helpful?
The openStream
function exposed by the SDK allows you to open a conversation or switch to a different conversation, specified by its streamId
.
In Focus mode, if a selector is provided, the SDK will either create a new iFrame and add the chat in it, or, if the container already included a chat, it will update the chat.
If the second parameter is not provided, or if in Collaboration mode, the chat will be opened in the main
iFrame (the one that was created with the render
function).
streamId
string
Stream ID of the chat conversation
containerSelector
string | undefined
Selector of the container to add the new Embedded Mode iFrame into (Focus mode only)
A Promise that resolves when the chat is ready. See the promise definition .
Open a different chat in the main iFrame:
Open a chat in a specific container:
The startRoom
function will let you start a direct message or group chat with specific users.
Similarly to the openStream
function, while in Focus mode, you can pass a containerSelector
parameter to open the chat in a specific container.
If a direct message or group chat with the user(s) already exists, it will open it. If it does not exist, it will create and open one.
Users
Array<string>
Array of users. Users can be represented by their user ID or email address.
containerSelector
string | undefined
Selector of the container in which to add the new Embedded Mode iFrame (Focus mode only)
Open a direct message in the main iFrame with a user identified by their user ID:
Open a group chat in a specific container with two users (one identified by their user ID, and one identified by their email address):
streamId
string | undefined
Stream ID of the chat displayed.
userIds
string[] | undefined
List of user IDs
A Promise that resolves when the chat is ready. See the promise definition .
The functions openStream
and startRoom
return a that will resolve once the chat is displayed. The promise has the following interface: