Invox Dictation SDK Version:

Essential Functions


Use these functions in order: initialize the SDK, register component callbacks, log in, select a writer target, and control dictation.

init

INVOX.init(config) stores the SDK configuration required by Login.

organizationId, appId, and apiKey are provided by Invox Medical for your integration. Use the exact values you receive; do not choose your own.

  • organizationId: String — required. Identifier of your organization in Corporate Server. It contains only lowercase letters, digits, and hyphens. Requests are routed to /<organizationId>/EasyDictation.
  • appId: String — required. Identifier of the application that integrates the SDK.
  • apiKey: String — required. API key associated with appId.
  • adminServiceUrl: String — optional. Base URL of the Corporate Server used for authentication and user data. If omitted, the SDK uses the Invox Medical Corporate Server. Provide it only when your organization uses its own Corporate Server installation, or when requests go through a proxy of your application; Invox Medical provides the URL in that case.
  • wakeWordAssetBaseUrl: String — optional. URL of the folder that contains the deployed wake-word-assets (wake-word models and WASM runtime). If omitted, the SDK looks for a wake-word-assets/ folder next to the SDK bundle. Provide it only if your integration uses wake-word detection and you publish that folder in another location of the same origin, for example /assets/wake-word-assets/.
import INVOX, {
  type InitializationConfigType,
} from "@invox-medical-npm/invox-dictation";

const config: InitializationConfigType = {
  organizationId: "provided-organization-id",
  appId: "provided_app_id",
  apiKey: "provided_api_key",
  // Only if your organization uses its own Corporate Server:
  // adminServiceUrl: "provided_admin_service_url",
  // Only if wake-word assets are not deployed next to the SDK bundle:
  // wakeWordAssetBaseUrl: "/assets/wake-word-assets/",
};

INVOX.init(config);

The Direct Dictation endpoint is selected by the SDK build. transcriptionServiceUrl is not accepted by this API.

CustomizeComponents

Register a callback before Login. The SDK invokes it after the session has been created so the callback can register component and recognizer callbacks.

INVOX.CustomizeComponents(() => {
  INVOX.OnChangeStatusBar((status) => {
    updateStatus(status);
  });
});

Calling Login without registering CustomizeComponents fails.

Login

INVOX.Login(credentials) authenticates with Corporate Server, imports the post-authentication data, creates the SDK session, and starts Direct Dictation. It returns Promise<void> and rejects when authentication or session setup fails.

import type { LoginCredentialsType } from "@invox-medical-npm/invox-dictation";

const credentials: LoginCredentialsType = {
  user: "provided_username",
  password: "provided_password",
};

try {
  await INVOX.Login(credentials);
} catch (error) {
  console.error("Login failed.", error);
}

Logout

INVOX.Logout() closes the current session. It returns Promise<boolean>; a resolved value of true confirms the close operation completed. Intentional logout also emits LOGGING_OUT.

const loggedOut = await INVOX.Logout();
if (loggedOut) {
  clearDictationUi();
}

Dictation controls

INVOX.SwitchDictation() changes between the running and paused recognizer states. INVOX.SetDictationRunning() and INVOX.SetDictationPaused() set an explicit state.

INVOX.SwitchDictation();

Writer target

Set a writer implementation and an editor target after a successful login. The public writer methods receive an editorInstance; pass the same target used by SetWriterTarget when invoking them directly.

const report = document.querySelector<HTMLTextAreaElement>("#report");
if (!report) {
  throw new Error("Report textarea is missing.");
}

INVOX.SetTextWriter(INVOX.TextAreaTextWriter);
INVOX.SetWriterTarget(report);

const target = await INVOX.GetWriterTarget();

See Writer Functions for Write, AppendText, selection, and synchronous or asynchronous writer behavior.