Create a room

Create a room

The createRoom function exposed by the SDK allows you to open a room creation dialog and prepopulate the room settings, room participants, and an initial message. The user can then update the prepopulated information and create the room in one click.

Alternatively, it is also possible to create a room silently, without showing a creation dialog, by setting the silent parameter. Please note that the Custom pricing tier is required for silent room creation. Note that if some of the members of the room are from a different company (External) and not connected with the logged in user, these unconnected users may not be added into the room if they are not configured to automatically accept connection requests.

In Focus mode, if a selector is provided, the SDK will create a new iFrame and show the room creation dialog in it.

If the selector parameter is not provided, or if in Collaboration mode, the dialog will be opened in the main iFrame (the one that was created with the render function).

Parameters

ParameterTypeDescription

roomName

string

name of the room (max 50 chars)

userIds

string[]

array of user Ids or user emails

options

Partial<ECPCreateRoomOptions>

room settings (see below) and initial message

selector

string | undefined

Selector of the container to add the new ECP iFrame into (Focus mode only)

ECPCreateRoomOptions contains the list of room settings that will be preselected, and is defined as below:

{
  public?: boolean;
  external?: boolean;
  multilateral?: boolean;
  allowHistoryBrowsing?: boolean;
  allowMessageCopy?: boolean;
  allowSendMessages?: boolean;
  allowAddUser?: boolean;
  discoverable?: boolean;
  message?: string | SharedMessage;
  silent?: boolean;
}

The format of the message is the same as the one described for the sendMessage method, with the exception of attachments, which are not yet supported.

The room settings preset can be automatically overridden in several situations:

  • Manually by the user, in the room creation dialog

  • Automatically because of the user entitlements or other admin controlled settings

  • Automatically if the preset settings are not compatible with one another. For example, if an external participant is prepopulated in the list of recipients, the room automatically becomes external.

The behavior is consistent with the room creation UI in the Symphony web app.

Returned promise

The Create room function returns a JavaScript Promise that will resolve once the action has been completed. The promise has the following interface:

- Success

ParameterTypeDescription

streamId

string [] | undefined

Stream ID of the chat where the message was sent.

userIds

string[] | undefined

List of user IDs

messages

object[] | undefined

Array of {messageId, streamId} representing the sent message

- Error

ParameterTypeDescription

type

string

Type of error: ERROR for generic errors INVALID_USERS if a user id was invalid NON_CONNECTED_USERS if some users were not connected to the current user

message

string

Description of the error

data

Object | undefined

Additional data on the error, if any.

Last updated