Adds the label with the given labelName to the current visitor. This only adds the label as long as it exists, can be set on visitors and the visitor is allowed to set the label.
A promise that resolves empty when the operation is done or is rejected if it failed.
Returns the currently active conversation or null
if no conversation is active.
NOTE: calling this method twice while the same conversation is active, will result in two individual conversation API instances being returned. destroying one of them will not cause the other one to also be destroyed. If however the active conversation is closed, all returned Conversation instances will be destroyed.
A promise that either resolves to the currently active conversation or null
if no conversation is open.
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
ACTIVE_CONVERSATION_CHANGE for the event whenever the active conversation changes
Returns the current availability state for the current named area and language.
A promise that resolves with the current agent availability state
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
All conversations accessible to the current user. If no conversation is present, an empty array is returned.
A promise that resolves to a list of all conversations accessible to the current user.
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Returns the number of unread messages.
A promise that resolves with the number of unread messages
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Returns the information about the current person.
A promise that resolves with the current person information
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Returns the view mode of the embedded app element.
A promise that resolves with the current view mode
{@link ViewMode.AUTO}
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Returns true if an agent is available for the current named area and language. False otherwise.
A promise that resolves with true if an agent is available, false otherwise
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Returns true if the UI is currently displayed in fullscreen, false otherwise.
A promise that resolves with true if the UI is in fullscreen mode, false otherwise
false
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Joins an existing conversation with a given PIN.
The PIN retrieved from the Unblu Agent Desk.
Optional
visitorName: stringThe name the local visitor should have. This is only taken into account if the visitor is not already authenticated.
A promise that resolves to the conversation which was joined
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Logs the current visitor in with the access token provided. Depending on the configuration, existing conversation may will be transferred to the authenticated user.
The access token (JWT) to authenticate the visitor with
A promise that resolves empty if the login succeeds or is rejected if it fails
Removes a previously registered listener
The event to unregister from.
The listener to remove.
Optional
data: anyUnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The activeConversationChange event.
The listener to be called.
UnbluEmbeddedApi.ACTIVE_CONVERSATION_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The conversationsChanged event.
The listener to be called.
UnbluEmbeddedApi.CONVERSATIONS_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The notificationCountChanged event.
The listener to be called.
UnbluEmbeddedApi.NOTIFICATION_COUNT_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The personChange event.
The listener to be called.
UnbluEmbeddedApi.PERSON_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The personActivity event.
The listener to be called.
Registers an event listener for the given event.
The agentAvailableChange event.
The listener to be called.
UnbluEmbeddedApi.AGENT_AVAILABLE_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The agentAvailabilityChange event.
The listener to be called.
UnbluEmbeddedApi.AGENT_AVAILABILITY_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The fullscreenChange event.
The listener to be called.
UnbluEmbeddedApi.FULLSCREEN_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The viewModeChange event.
The listener to be called.
UnbluEmbeddedApi.VIEW_MODE_CHANGE
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The deinitializing event.
The listener to be called.
UnbluEmbeddedApi.DEINITIALIZING
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Registers an event listener for the given event.
The deinitialized event.
The listener to be called.
UnbluEmbeddedApi.DEINITIALIZED
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Opens the conversation for the given conversation ID.
If the conversation doesn't exist or the user doesn't have the right to access it, a dialog will be displayed with the respective error message.
Be aware that in such a case the promise will still resolve successfully as the UI switched into the conversation view showing the error dialog. - The active conversation property will however be set to null
.
The id of the conversation to open. Using null will close the current conversation and open the overview of conversations
A promise that resolves with the opened conversation instance, null
if the overview was opened, or it is rejected with an error if it did not work.
UnbluEmbeddedAppElement.ATTR_CONVERSATION_ID to set this as attribute
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Removes the label with the given labelName from the current visitor. This only removes the label as long as the visitor has the label applied to themselves and the visitor is allowed to remove the label.
A promise that resolves empty when the operation is done or is rejected if it failed.
When this attribute is set to true, the embedded app element will ignore the position and size set to its element and will used fixed positioning to display itself to cover the whole website.
Note: The user itself can also toggle this inside the UI.
True to enable fullscreen, false otherwise.
A promise that resolves as soon as the value has been applied
false
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Sets a custom interceptor which will be triggered when a new conversation is started (initiated from UI or JavaScript).
The interceptor which should be triggered on new conversations
A promise that resolves as soon as the new interceptor has been applied
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Sets the nickname of the current user.
This is only respected for anonymous visitors.
A promise that resolves as soon as the value has been applied
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Sets the view mode of the embedded app element.
Depending on the view mode the UI is displayed the following way:
ViewMode.SPLIT: The UI will be divided into two parts. The list of conversations is displayed on the left and the active conversation on the right side.
ViewMode.SINGLE: Both the conversation list and the active conversation will be displayed in the same view using UI navigation to switch between them.
ViewMode.AUTO: The UI will automatically switch back and forth between the two other modes depending on the available width. The trigger point when to switch between the two modes can be configured on the Unblu collaboration server.
The new view mode to use
A promise that resolves as soon as the value has been applied
{@link ViewMode.AUTO}
UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.
Starts a new conversation and places it into the inbound conversation queue.
Starting a new conversation involves an agent availability check. For ConversationType.OFFLINE_CHAT_REQUEST conversations, the check proceeds as follows:
For all online
conversation types, the check works as follows:
You should therefore always check agent availability before starting a new conversation. If no agents are available, only start conversations of the type ConversationType.OFFLINE_CHAT_REQUEST.
The type of the conversation
Optional
visitorName: stringThe name of the visitor. This is only respected for anonymous visitors
Optional
visitorData: stringCustom visitor data that will be stored on the conversation and can be accessed through the Web API later on. This data won't be displayed anywhere and is for API usage only.
Optional
recipient: NewConversationRecipientThe team or agent recipient of the conversation. This will overwrite any named area that might be set for this web page.
A promise that resolves to the conversation which was started
UnbluApiError of type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized or if the conversation type may not be started.
Static
Readonly
ACTIVE_Event emitted every time the active conversation changes.
This may happen due to a UI-navigation or an API-call.
activeConversationChange
Static
Readonly
AGENT_Event emitted every time the agent availability state changes for the current named area and locale.
availabilityChange
Static
Readonly
AGENT_Event emitted every time the agent availability changes for the current named area and locale.
availableChange
Static
Readonly
CONVERSATIONS_Event emitted every time one of the conversations accessible to the current user changes or one is added or removed.
conversationsChanged
Static
Readonly
DEINITIALIZEDEvent emitted when this instance got de-initialized and has to be initialized again.
Note: After this event, the instance of UnbluEmbeddedApi is no longer usable.
deinitialized
Static
Readonly
DEINITIALIZINGEvent emitted when this instance gets de-initialized and is not usable at the time until it fully got de-initialized.
deinitializing
Static
Readonly
FULLSCREEN_Event emitted every time the embedded app switches to fullscreen mode or back.
fullscreenChange
Static
Readonly
NOTIFICATION_Event emitted every time the notification count (unread messages) changes.
notificationCountChange
Static
Readonly
PERSON_Event emitted every time the local person has some activity inside Unblu. This may be i.e. an interaction with the chat, a call, opening a conversation or interacting with a co-browsing layer.
The event can be used to reset the logout timer inside an authenticated area, for example.
The configuration property com.unblu.conversation.activity.activityCategoriesToTrack specifies which categories of activity trigger the event.
personActivity
Static
Readonly
PERSON_Event emitted every time the local person changes. This may be i.e. due to the person setting its name.
personChange
Static
Readonly
VIEW_Event emitted every time the view mode changes.
viewModeChange
This is the main class to interact with the Unblu embedded web component after initialization is done.
An instance of the UnbluEmbeddedApi is returned by calling UnbluEmbeddedAppElement.initialize or listening to the UnbluEmbeddedAppElement.READY event.
Note: After deinitialization an instance of UnbluEmbeddedApi is no longer usable and will throw errors on API calls. In order to access the API again, it is required to initialize Unblu again.