API

The RofimWidgetHTMLElement API allows a developer to interact and manage the Sana from his web application.

This object has methods and emits event that the web application can listen to.

show()

Displays the chat widget.
When in LIGHTBOX mode, displays the fold/unfold button

hide()

Hides the chat widget.
When in LIGHTBOX mode, hides the fold/unfold button

toggleVisibility()

Toggles between showing and hiding the widget.

Returns

Returns true if visible, false otherwise

deployLightbox()

Deploys the widget in LIGHTBOX mode.

Throws

Thows an error if the widget is not in LIGHTBOX mode

foldLightbox()

Folds the widget in LIGHTBOX mode.

Throws

Thows an error if the widget is not in LIGHTBOX mode

asyncgetUnreadMessagesNumber()

Returns the number of unread messages.

Returns

Number of unread message

asyncmarkAllAsRead()

Marks all messages as read.

Returns

asyncsendMessage()

Sends a message in a room

Parameters

roomId string required

roomId where to send the message

message AbstractMessage required

Message to send

Returns

asyncsendFileMessage()

Sends a file in a room

Parameters

securityToken string required

securityToken obtained from the UploadCallback

message FileMessage required

File to send

Returns

asynccreateRoom()

Creates a new room

Parameters

roomCreationRequest RoomCreationRequest required

Room creation request

Returns

Returns a Room object

asyncgetRoom()

Get a Room details

Parameters

roomId string required

roomId to get

Returns

Returns a Room object or null if no Room match the roomId

asynclogout()

The user is logged out.
The Sana Widget is removed from the DOM

Returns