Configures the API to initialize Unblu.
Note: This method must be called BEFORE initialize. Calling it afterwards throws an UnbluApiError.
The configuration to set.
an instance of this allowing chaining like unblu.agentEmbedded.api.configure({...}).initialize();
isConfigurationNeeded to check if configuration is needed or not.
Returns the current state of the API
the current API state.
isInitialized for a simpler check
Initializes the API.
There is only ever one instance of the API, and it is returned by any call of this method. This makes it safe to call the method multiple times. If the API has already been initialized or is being initialized, the method returns the existing API.
The fully initialized API
UnbluApiError with type UnbluErrorType.CONFIGURATION_MISSING if a configuration is needed but none was provided
UnbluApiError with type UnbluErrorType.ERROR_LOADING_UNBLU if loading Unblu encounters a problem
UnbluApiError with type UnbluErrorType.INITIALIZATION_TIMEOUT if the initialization timed out
UnbluApiError with type UnbluErrorType.INCOMPATIBLE_UNBLU_VERSION if the Unblu API is incompatible with the Collaboration Server
UnbluApiError with type UnbluErrorType.UNSUPPORTED_BROWSER if the browser is unsupported
Checks whether the API has to be configured or not.
If the API is in [INITIAL]ApiState.INITIAL or [DEINITIALIZED]ApiState.DEINITIALIZED state, it needs to be configured.
true if a configuration is needed to initialize the API, false otherwise.
Checks whether the API is initialized or not.
true if the API is initialized, false for any other state.
getApiState for the full state
Removes a previously registered listener.
The event unregister.
The listener to be removed.
true if the listener was removed, false otherwise.
Registers an event listener for the given event.
Note If the API is already initialized, this listener will be called directly.
The ready event
The listener to be called.
Registers an event listener for the given event.
Note If the API has already failed, this listener will be called directly.
The error event
The listener to be called.
Registers an event listener for the given event.
Note If the API is already deinitializing, this listener will be called directly.
The deinitializing event
The listener to be called.
Registers an event listener for the given event.
Note If the API is already deinitialized, this listener will be called directly.
The deinitialized event
The listener to be called.
Registers an event listener for the given event.
The state event
The listener to be called.
Static ReadonlyDEINITIALIZEDEvent emitted as soon as the API is completely deinitialized.
It usually makes sense to use this event to clean up resources and/or unregister listeners so there are no attempts to use the API until it's been initialized again.
deinitialized
on for listener registration
Static ReadonlyDEINITIALIZINGEvent emitted as soon as the API is going to be deinitialized.
It usually makes sense to use this event to clean up resources and/or unregister listeners so there are no attempts to use the API until it's been initialized again.
deinitializing
on for listener registration
Static ReadonlyERROREvent emitted if the API initialization fails.
This event can be used to react to the fact that the API failed to initialize. A typical case would be to adapt some general UI state.
Don't use this event next to the code that is initializing the API. Instead, use
unblu.agentEmbedded.api.initialize().catch(error=> { //handle error here });
or
try{
let api = await unblu.agentEmbedded.api.initialize();
}catch(e){
// handle error here
}
error
on for listener registration
Static ReadonlyREADYEvent emitted as soon as the API is initialized.
This event can be used to react to the fact that the API was initialized. A typical case would be to adapt some general UI state.
Don't use this event next to the code that is initializing the API. Instead, use
unblu.agentEmbedded.api.initialize().then(api => { //use api here });
or
let api = await unblu.agentEmbedded.api.initialize();
// use api here
Note that this event is triggered each time the API is initialized.
ready
on for listener registration
Static ReadonlySTATEEvent emitted whenever the API state changes
state
on for listener registration
The central entry point to configure and initialize the Unblu Agent Embedded JS API.
The Unblu Agent Embedded JS API can be used to embed agent functionalities in third-party software such as an existing CRM system.
Before using the API, you must first configure and then initialized it. Example: