Share via


Initialize Dragon Copilot SDK for JavaScript

To initialize the Dragon Copilot SDK, call DragonCopilotSDK.dragon.initialize with initialization options.

Prerequisites

Initialization options

For detailed information on the data types used by the initialization options, see the API reference.

Property Type Required Description Default value
services String Yes Region code for the Dragon Copilot service the user is connecting to. This can be one of:

us - USA
ca - Canada
de - Germany
fr - France
uk - United Kingdom
applicationName String Yes The name of the application integrating the SDK.
authentication AuthenticationOptions Yes Your app authenticates with Dragon Copilot using a callback provided here.
partnerGuid String Yes You receive a partner GUID when you onboard as a Dragon Copilot SDK partner. -
enableAll Boolean No Enables speech recognition for all text fields. true
speechOptions SpeechOptions No The language and topic (i.e. specialty) for speech recognition in dictation mode.
containerSelector String No The CSS selector of the DOM element which serves as a direct or indirect container for the text controls to be speech-enabled. This DOM element will be monitored by the SDK for DOM changes. If not provided, the SDK defaults to using the document body as the container.
correctionOptions CorrectionOptions No Correction-related configuration options.
useConsoleLogger Boolean or ConsoleLoggerOptions No Enables console logging or provides logger options. false
environmentId String No The user's environment ID from Dragon admin center.
customControlOptions CustomControlOptions No Provides the set of custom controls.
dispatchAllCommands Boolean No If true, dispatches all recognized commands. false
traceId String No Trace ID for logging and diagnostics.
isAmbientEnabled Boolean No Enables/disables ambient recording mode. false
isDictationEnabled Boolean No Enables/disables dictation mode. true
platformGuid String No The platform GUID for integration.
daxProductId String No The DAX product ID.
preferredMicrophone PreferredMicrophone No Sets the preferred microphone.
buttonPreferences Partial<MicrophoneButtonPreferences> No Microphone button settings.
navigationOptions Partial<NavigationOptions> No Field delimiter and navigation preferences for Dragon Copilot texts.
clientType ClientType No Type of client, for mobile mic implementations.
additionalSystemCommandSpokenForms AdditionalSystemCommandSpokenForms No Extends built-in system commands with custom spoken forms while preserving their original built-in spoken form.
mobileMicOptions MobileMicOptions No Enables/disables mobile mic functionality.
autotextOptions AutotextOptions No Enables/disables Dragon Copilot text functionality. true
enableCommandWithoutPause Boolean No Enables the user to say a voice command immediately after dictation without a pause.

Examples

Minimal initialization

await DragonCopilotSDK.dragon.initialize({
  services: "us",
  authentication: {
    acquireAccessToken: acquireAccessTokenCallback,
  },
  partnerGuid: "MyPartnerGuid",
  applicationName: "MyApp",
});

Advanced initialization

await DragonCopilotSDK.dragon.initialize({
  applicationName: "Sample2",
  enableAll: true,
  partnerGuid: settings.partnerGuid,
  authentication: {
    acquireAccessToken: acquireAccessTokenCallback,
  },
  services: "us",
  speechOptions: {
      language: "en-US",
      topic: dragon.Topics.GeneralMedicine,
  },
  useConsoleLogger: false,
  isAmbientEnabled: false,
  isDictationEnabled: true,
  daxProductId: "",
  traceId: "",
  customControlOptions: {
      webCustomControlTypes: {
          lexicalControl,
      },
  },
  dispatchAllCommands: true,
  environmentId: "test-app",
  platformGuid: "",
  preferredMicrophone: {
      label: "",
  },
});

Initialization errors

The Dragon Copilot SDK can throw one of the following errors when you call DragonCopilotSDK.dragon.initialize():

Error type Error message Description
IntegrationError services are required. The ServiceConfig object isn't provided.
IntegrationError dragonMedicalServer is required. dragonMedicalServer is missing from the ServiceConfig object.
IntegrationError dragonMedicalServer.url is required and must be a string. The url under dragonMedicalServer is empty or missing.
IntegrationError dragonMedicalServer.url must use HTTPS protocol The url under dragonMedicalServer doesn't use HTTPS protocol.
IntegrationError Invalid service URL The url under dragonMedicalServer has an invalid domain.
Error(HTTP Error) Failed to fetch service config Applies to the CDN-hosted SDK: There was an HTTP error downloading the ServiceConfig details from https://download.microsoft.com/download/f6aaaef1-c23a-4d24-88e9-3b66d39e19de/dragon-copilot-sdk/serviceconfig/<region>.json.
Error(HTTP Error) Failed to get dax endpoint. Status: <HTTPStatus> The configService URL is provided with the ServiceConfig object but the SDK fails to get the DAX endpoint and Dragon Medical Server URL from the configuration service.
InternalError Cookies disabled: Speech recognition is unavailable; make sure you have enabled cookies for your browser. Cookies are disabled.
InternalError Some features might not work because your browser version isn't supported. Please upgrade to the latest version. The browser version isn't supported.

See also

API reference