Entry point for applications to configure and use the Omni SDK. This class contains utility methods to initialize and shutdown the Omni SDK. Few other functionalities like setting log level, resetting idle timeout, setting event listeners for common Omni SDK events are also provided in this class.

Methods

  • Attach event handler callback that needs to be invoked when user has remained inactive for the duration configured in InitParams.idleTimeoutDuration.

    Parameters

    Returns string

    Unique event handler id that was generated by Omni SDK when the event handler was attached.

  • Attach event handler callback that needs to be invoked when Omni SDK gets initialized.

    Type Parameters

    Parameters

    Returns string

    Unique event handler id that was generated by Omni SDK when the event handler was attached.

  • Attach event handler callback that needs to be invoked when Omni SDK shuts down.

    Parameters

    Returns string

    Unique event handler id that was generated by Omni SDK when the event handler was attached.

  • Initiate a new conversation between the current user (identified by the JWT) and the contact center.

    Note: Before calling this method, it is mandatory for the Omni SDK to be initialized.

    Returns Promise<CoreConversation>

    A promise that resolves to a conversation object of type CoreConversation.

  • Initiate a new conversation between the current user (identified by the JWT) and the contact center. The EnhancedConversationClass provided here should be the same used to initialize the Omni SDK Note: Before calling this method, it is mandatory for the Omni SDK to be initialized.

    Type Parameters

    Parameters

    • EnhancedConversationClass: T

      Enhanced (Mixed) class that extends CoreConversation, which was generated by applying the Mixins. This should be the same class that was provided to the the Omni SDK during initialization in init method.

    Returns Promise<InstanceType<T>>

    A promise that resolves to a conversation object of type EnhancedConversationClass.

  • Get the default conversation of the User if one exists.

    Note: Before calling this method, it is mandatory for the Omni SDK to be initialized.

    Note: In order to fully leverage the advantages of TypeScript, it is recommended to specify the type of the conversation class that was provided to the Omni SDK during initialization. See init method. If no class was provided to the Omni SDK during initialization, then the default conversation class will be CoreConversation and there is no need to specify the type.

    Type Parameters

    • T extends Constructable<CoreConversation>

      The type of the conversation class that was provided to the Omni SDK during initialization.

    Returns undefined | InstanceType<T>

    Instance of class T (that extends CoreConversation and was provided to the Omni SDK in init method) if the default conversation exists, else undefined.

    const defaultConversation = AvayaInfinityOmniSdk.getDefaultConversation<typeof ConversationMixedClass>();
    
  • Initialize the Omni SDK with the given parameters. Before any operation can be performed with the Omni SDK, it must be initialized. The initialization process creates a new session for the current user (identified by the JWT) and returns a UserSession object that contains the Conversation object corresponding to the User's ongoing conversation.

    Parameters

    • initParams: InitParams

      Initialization data required to initialize the Omni SDK.

    Returns Promise<UserSession<CoreConversation>>

    A promise that resolves to UserSession with conversation of type CoreConversation.

  • Initialize the Omni SDK with the given parameters. Before any operation can be performed with the Omni SDK, it must be initialized. The initialization process creates a new session for the current user (identified by the JWT) and returns a UserSession object that contains the Conversation object corresponding to the User's ongoing conversation.

    Type Parameters

    Parameters

    • initParams: InitParams

      Initialization data required to initialize the Omni SDK.

    • EnhancedConversationClass: T

      Enhanced (Mixed) class that extends CoreConversation, which was generated by applying the Mixins.

    Returns Promise<UserSession<InstanceType<T>>>

    A promise that resolves to UserSession with conversation of type EnhancedConversationClass.

    const ConversationMixedClass = MessagingConversation();

    const omniSdkUserSession = await AvayaInfinityOmniSdk.init({
    displayName: <displayName>,
    token: <jwt_token>,
    integrationId: <integration_id>,
    host: <region>,
    logLevel: <logLevel>,
    idleTimeoutDuration: <idleTimeOutDuration>,
    idleShutdownGraceTimeoutDuration: <graceTimeoutDuration>,
    jwtProvider: <jwtProviderImpl>
    }, ConversationMixedClass);
  • Remove the event handler callback that was attached to the idle timeout event.

    Parameters

    • eventHandlerId: string

      Event handler id that was received at the time of attaching the event handler.

    Returns void

  • Remove the event handler callback that was attached to the Omni SDK initialization event.

    Parameters

    • eventHandlerId: string

      Event handler id that was received at the time of attaching the event handler.

    Returns void

  • Remove the event handler callback that was attached to the Omni SDK shutdown event.

    Parameters

    • eventHandlerId: string

      Event handler id that was received at the time of attaching the event handler.

    Returns void

  • Reset the idle timer to indicate the Omni SDK that the user session is still active. The Omni SDK automatically resets the timeout when selective methods from other Omni SDK modules are called for e.g when a message is sent by the User through Avaya Infinity Messaging Module.

    Call this method to keep the session active when the User's actions are visible to the client but not traceable by the Omni SDK. Examples of such activities could include when the User is browsing/interacting with the website.

    Returns void

  • Renew the JWT for the current User. Note: Before calling this method, it is mandatory for the Omni SDK to be initialized.

    Parameters

    • token: string

      New JWT token to be set.

    Returns void

  • Sets the log level of Omni SDK.

    Parameters

    Returns void

  • Shutdown the Omni SDK and close the session with Avaya Infinity servers. To use the Omni SDK again after shutdown, re-initialize it by calling init.

    Note: Before calling this method, it is mandatory for the Omni SDK to be initialized.

    Parameters

    • OptionalshutdownReason: ShutdownReason

      Reason for shutting down the Omni SDK.

    Returns Promise<void>

  • Returns string