Skip to main content
This page covers the frontend configuration object passed to loadAgent. Configure assistant behavior, tools, and widget metadata in the Ringg AI dashboard; use this object for page-level runtime settings.

CDN loader

The widget script exposes loadAgent after the CDN bundle finishes loading. Two builds are published: pick the one that matches how your host page loads JavaScript.
BundleWhen to use
dv-agent.es.jsModule-aware setups: Vite, webpack, Next, or anything loaded inside <script type="module">.
dv-agent.umd.jsjQuery pages, legacy CMS themes, and any host page that loads scripts with a plain <script> tag.
The ES bundle is only safe inside module-aware setups. Loading dv-agent.es.js as a plain <script> leaks internals onto window and can clobber globals like jQuery’s $, which breaks the host page. Use dv-agent.umd.js on any non-module page.
<script type="module">
  function loadAgentsCdn(version, done) {
    const stylesheet = document.createElement("link");
    stylesheet.rel = "stylesheet";
    stylesheet.type = "text/css";
    stylesheet.href = `https://cdn.jsdelivr.net/npm/@desivocal/agents-cdn@${version}/dist/style.css`;

    const script = document.createElement("script");
    script.type = "module";
    script.onload = done;
    script.src = `https://cdn.jsdelivr.net/npm/@desivocal/agents-cdn@${version}/dist/dv-agent.es.js`;

    document.head.appendChild(stylesheet);
    document.head.appendChild(script);
  }
</script>
Use latest while exploring in development. For production, pin the tested CDN version and update CSP entries to match the bundle (dv-agent.es.js or dv-agent.umd.js) you ship.

Base configuration

loadAgentsCdn("latest", function () {
  loadAgent({
    agentId: "your-agent-id",
    xApiKey: "your-api-key",
    variables: {
      callee_name: "John",
      account_id: "ACC-42",
    },
    defaultTab: "audio",
    hideTabSelector: false,
    title: "Talk to our assistant",
    description: "Ask a question or start a voice call.",
    buttons: {
      modalTrigger: {
        styles: {
          backgroundColor: "#4F46E5",
          color: "white",
          borderRadius: "50%",
        },
      },
      call: {
        textBeforeCall: "Start Call",
        textDuringCall: "End Call",
      },
    },
    widgetPosition: {
      triggerPlacement: "fixed",
      triggerAlignment: "bottom-right",
      hideTriggerOnExpand: true,
      widgetAlignment: "bottom-right",
    },
  });
});

Core options

OptionTypeDefaultDescription
agentIdstringRequiredAssistant ID to load in the widget.
xApiKeystringRequiredWidget API key from the dashboard embed code.
variablesobject{}Runtime variables available to the assistant.
defaultTab"audio" | "text""audio"Tab shown when the widget loads. Use "text" for chat mode. Supported from v1.0.8+.
hideTabSelectorbooleanfalseHides the audio/text tab switcher for a single-mode experience. Supported from v1.0.8+.
bypassStartScreenbooleanfalseSkips the start screen and begins a call or chat immediately on trigger click. Uses defaultTab.
titlestringUnsetHeading shown in the widget start screen.
descriptionstringUnsetSupporting copy shown in the widget start screen.
logoUrlstringUnsetLogo image URL shown in the widget.
buttonsobject{}Trigger and call button customization.
widgetPositionobjectFixed bottom-rightPlacement rules for the trigger and expanded widget.
feedbackScreenobjectUnsetText for the post-conversation feedback screen.

Variables

Use variables for page-specific context that the assistant prompt expects.
loadAgent({
  agentId: "your-agent-id",
  xApiKey: "your-api-key",
  variables: {
    callee_name: "John",
    account_id: "ACC-42",
    plan_name: "Enterprise",
  },
});
Variables are sent from the browser. Do not put secrets, internal tokens, or sensitive data in the widget configuration.

Mode controls

loadAgent({
  agentId: "your-agent-id",
  xApiKey: "your-api-key",
  defaultTab: "audio",
  hideTabSelector: false,
});
For chat setup, see Chat and Widgets.

Widget positioning

Positioning controls are supported from v1.0.19+.
Fixed mode is the default. The trigger floats over the page and is anchored to the browser viewport.
loadAgent({
  agentId: "your-agent-id",
  xApiKey: "your-api-key",
  widgetPosition: {
    triggerPlacement: "fixed",
    triggerAlignment: "bottom-right",
    hideTriggerOnExpand: true,
    widgetAlignment: "bottom-right",
  },
});
OptionTypeDefaultDescription
triggerPlacementstring"fixed"Use "fixed" for viewport placement or "absolute" for the ringg_ai_container container.
triggerAlignmentstring"bottom-right"Trigger button position.
hideTriggerOnExpandbooleantrueHides the trigger button when the widget is open.
widgetAlignmentstring"bottom-right"Expanded widget position.

Trigger button customization

Trigger button customization is supported from v1.0.19+.
loadAgent({
  agentId: "your-agent-id",
  xApiKey: "your-api-key",
  buttons: {
    modalTrigger: {
      styles: {
        backgroundColor: "#4F46E5",
        color: "white",
        width: 64,
        height: 64,
        borderRadius: "50%",
      },
      icon: {
        url: "https://example.com/my-icon.svg",
        size: 24,
      },
    },
  },
});
OptionTypeDefaultDescription
buttons.modalTrigger.stylesCSSPropertiesUnsetButton CSS styles, such as width, height, backgroundColor, color, and borderRadius.
buttons.modalTrigger.icon.urlstringRingg phone iconCustom trigger icon URL.
buttons.modalTrigger.icon.sizenumber20Icon size in pixels.

Call button labels

loadAgent({
  agentId: "your-agent-id",
  xApiKey: "your-api-key",
  buttons: {
    call: {
      textBeforeCall: "Start Call",
      textDuringCall: "End Call",
    },
  },
});

Feedback screen

Use feedbackScreen to customize the post-conversation feedback copy.
loadAgent({
  agentId: "your-agent-id",
  xApiKey: "your-api-key",
  feedbackScreen: {
    title: "How was your chat?",
    description: "Your feedback helps us improve!",
    submitBtnCTA: "Submit",
  },
});
OptionTypeDescription
feedbackScreen.titlestringTitle shown on the feedback screen.
feedbackScreen.descriptionstringSupporting feedback copy.
feedbackScreen.submitBtnCTAstringText for the submit button.