Unblu Agent Embedded JS API
    Preparing search index...

    Class UnbluStaticAgentEmbeddedApi

    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:

     const api = await unblu.agentEmbedded.api
    // configure the unblu server
    .configure({
    serverUrl: "<unblu-server-url>" //if the Collaboration Server is embedded behind the same domain this isn't even needed
    })
    // initialize the api.
    .initialize();

    Implements

    • UnbluAgentEmbeddedApiFactory
    Index

    Methods

    • Returns the current state of the API

      Returns ApiState

      the current API state.

      isInitialized for a simpler check

    • 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.

      Returns boolean

      true if a configuration is needed to initialize the API, false otherwise.

    • Checks whether the API is initialized or not.

      Returns boolean

      true if the API is initialized, false for any other state.

      getApiState for the full state

    • Removes a previously registered listener.

      Parameters

      • event: string

        The event unregister.

      • listener: Listener

        The listener to be removed.

      Returns boolean

      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.

      Parameters

      • event: "ready"

        The ready event

      • listener: ReadyListener

        The listener to be called.

      Returns void

      READY

    • Registers an event listener for the given event.

      Note If the API has already failed, this listener will be called directly.

      Parameters

      • event: "error"

        The error event

      • listener: ErrorListener

        The listener to be called.

      Returns void

      ERROR

    • Registers an event listener for the given event.

      Note If the API is already deinitializing, this listener will be called directly.

      Parameters

      Returns void

    • Registers an event listener for the given event.

      Note If the API is already deinitialized, this listener will be called directly.

      Parameters

      Returns void

    • Registers an event listener for the given event.

      Parameters

      • event: "state"

        The state event

      • listener: StateListener

        The listener to be called.

      Returns void

      STATE

    Events

    DEINITIALIZED: "deinitialized" = ...

    Event 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

    DEINITIALIZING: "deinitializing" = ...

    Event 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

    ERROR: "error" = ...

    Event 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

    READY: "ready" = ...

    Event 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

    STATE: "state" = ...

    Event emitted whenever the API state changes

    state

    on for listener registration