Unblu Agent Embedded JS API
    Preparing search index...

    Class UnbluAgentEmbeddedApi

    This is the main class to interact with the Unblu Agent Embedded API after initialization.

    An instance of the UnbluAgentEmbeddedApi is returned by calling UnbluStaticAgentEmbeddedApi.initialize or listening to the UnbluStaticAgentEmbeddedApi.READY event.

    Note: After deinitialization, an instance of UnbluAgentEmbeddedApi is no longer usable and throws errors on API calls. To access the API again, you must initialize Unblu again.

    Implements

    • ApiStateProvider
    Index

    Properties

    conversationConnections: UnbluConversationConnectionsApi

    Access the conversations the agent is currently connected to, and connect to or disconnect from conversations

    conversationHistory: UnbluConversationHistoryApi

    Access conversation history functionality

    conversationTemplates: UnbluConversationTemplatesApi

    Access the conversation templates of the account

    Access inbox functionality

    notification: UnbluNotificationApi

    Access notification functionality

    Access the teams of the account

    Methods

    • Adds the label with the given labelName to the local person. This only adds the label if:

      • The label already exists
      • the label may be assigned to agents
      • The local person is allowed to set the label

      Parameters

      • labelName: string

      Returns Promise<void>

      Empty once the operation is done

      UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.

      UnbluApiError if the call fails

    • Deinitializes the Unblu Embedded Agent Web Component. After deinitialization, the API is no longer usable and the UI is completely destroyed.

      Returns Promise<void>

    • Returns the information about the local person.

      Returns Promise<PersonInfo>

      The current person information

      UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.

    • Returns 'true' if this instance of the API is deinitialized, 'false' otherwise.

      Returns boolean

    • Joins a conversation by redeeming the given invitation token.

      The token comes from an invitation, for example an assignment request, an agent or team invitation, or an agent or team forwarding. The local user must be eligible to redeem the invitation.

      This does *NOT* connect the conversation. Use UnbluConversationConnectionsApi.connect to connect it.

      Parameters

      • invitationToken: string

        The invitation token to redeem

      Returns Promise<string>

      The conversation ID of the joined conversation

      UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.

      UnbluApiError if the token cannot be redeemed

    • Removes a previously registered listener

      Parameters

      • event: AgentEmbeddedMetaEventType | AgentGeneralEventType

        The event to unregister from.

      • listener: (data?: any) => void

        The listener to remove.

      Returns Promise<boolean>

      UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.

    • Removes the label with the given labelName from the local person. This only removes the label if:

      • The label is assigned to the local person
      • The local person is allowed to remove the label

      Parameters

      • labelName: string

      Returns Promise<void>

      Empty once the operation is done

      UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.

      UnbluApiError if the call fails

    • Sets a custom interceptor which is triggered when a new conversation is started (initiated from UI or JavaScript).

      Parameters

      Returns Promise<void>

      Empty once the interceptor has been applied and is active

      UnbluApiError with type UnbluErrorType.ILLEGAL_STATE when the API instance is deinitialized.

    Events

    CONNECTION_STATE_CHANGE: "connectionStateChange" = ...

    Event emitted every time the connection state changes.

    connectionStateChange

    DEINITIALIZED: "deinitialized" = ...

    Event emitted when this instance got de-initialized and has to be initialized again.

    deinitialized

    DEINITIALIZING: "deinitializing" = ...

    Event emitted when this instance has been deinitialized and is not usable. It can only be initialized again once it's fully deinitialized.

    deinitializing

    PERSON_CHANGE: "personChange" = ...

    Event emitted every time the local person changes, for example, due to the person setting their name.

    personChange