The RofimWidgetHTMLElement API allows a developer to interact with and manage the Sana from their web application.
This object has methods and emits events 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(): boolean
Toggles between showing and hiding the widget.
Returns
Returns true if visible, false otherwise.
deployLightbox()
Deploys the widget in LIGHTBOX mode.
Throws
Throws an error if the widget is not in LIGHTBOX mode.
foldLightbox()
Folds the widget in LIGHTBOX mode.
Throws
Throws an error if the widget is not in LIGHTBOX mode.
asyncgetUnreadMessagesNumber(): Promise<number>
Returns the number of unread messages.
Returns
Number of unread messages.
asyncmarkAllAsRead(): Promise<void>
Marks all messages as read.
Returns
asyncsendMessage(roomId: string, message: AbstractMessage): Promise<void>
Sends a message in a room.
Parameters
roomId of the room to send the message to.
Message to send.
Discriminator for the message type.
Returns
asyncsendFileMessage(securityToken: string, message: FileMessage): Promise<void>
Sends a file in a room.
Parameters
securityToken obtained from the UploadCallback.
File to send.
Returns
asynccreateRoom(roomCreationRequest: RoomCreationRequest): Promise<Room>
Creates a new room.
Parameters
Room creation request.
Returns
Returns a Room object.
asyncopenOrCreateRoom(request: OpenOrCreateRoomRequest): Promise<Room>
Opens an existing room with the specified users, or creates one if no matching room exists.
Parameters
Room request.
Optional name for the room if it needs to be created.
Complete Synapse user IDs to include, such as @user:server.
Returns
Returns a Room object.
asyncgetRoom(roomId: string): Promise<Room>
Gets the details of a room.
Parameters
roomId of the room to get.
Returns
Returns a Room object.
asynclogout(): Promise<void>
Logs the user out.
The Sana Widget is removed from the DOM.
Returns
asyncrequestNotificationsPermission(): Promise<void>
Asks the user for permission to enable push notifications.
Returns
asyncdisableNotifications(): Promise<void>
Unregisters from push notifications.
Returns
asyncisNotificationsEnabled(): Promise<boolean>
Indicates whether push notifications are enabled.
Returns
asyncsendResource(securityToken: string, resource: AbstractResource): Promise<void>
Sends a resource to the room associated with the security token.
Parameters
Security token provided by the callback.
Resource to send to the room associated with the security token.
Discriminator for the resource type.
