Logo
Search
API Docs

Vanilla HTML Script Tag Integration

Chat Agents

Vanilla HTML Script Tag Integration

Overview

The HTML script tag embed adds a voice widget to any website without installing any packages or using a framework. You paste a small snippet into your page, it loads the SDK from a CDN, and a floating call button appears automatically — no additional HTML markup required. This is the original, simplest way to embed voice on a plain HTML page.


Basic Implementation

Copy this snippet into your HTML page, replacing the placeholder values with your own credentials:

<script>
  var sulusInstance = null;
  const assistant = "<assistant_id>"; // Substitute with your assistant ID
  const apiKey = "<your_public_api_key>"; // Substitute with your Public key from the Sulus dashboard
  const buttonConfig = {}; // Modify this as required

  (function (d, t) {
    var g = document.createElement(t),
      s = d.getElementsByTagName(t)[0];
    g.src =
      "https://cdn.sulus.ai/html-script-tag/latest/dist/assets/index.js";
    g.defer = true;
    g.async = true;
    s.parentNode.insertBefore(g, s);

    g.onload = function () {
      sulusInstance = window.sulusSDK.run({
        apiKey: apiKey,   // mandatory
        assistant: assistant, // mandatory
        config: buttonConfig, // optional
      });
    };
  })(document, "script");
</script>

The script dynamically loads the SDK from the CDN with defer and async so it doesn't block page rendering. Once loaded, window.sulusSDK.run() initializes the widget and the floating call button appears on the page automatically — you don't need to add any extra HTML for it. The returned sulusInstance can be used to control the widget programmatically afterward.


Required & Optional Parameters

ParameterRequiredDescription
apiKeyMandatoryYour public API key from the Sulus dashboard
assistantMandatoryYour assistant ID
configOptionalButton/widget configuration object

Finding Your Keys

  1. Log in to your Sulus dashboard
  2. Click your profile in the top right, then copy your Public API Key
  3. Navigate to Assistants in the left sidebar and copy your assistant's ID

Unlike private keys, public keys are safe to expose in your website's client-side code.


Compared to the Newer Web Widget

This script tag approach is the original, simpler predecessor to the newer embeddable widget element covered in Web Widget and Web Widget Advanced Styling & Consent Options. The newer widget supports both voice and chat modes and offers significantly more styling and configuration options. If you're starting a new integration and don't have a reason to use the plain script tag specifically, the newer widget is generally the better current option; use this page if you already have the script tag embedded or need the minimal, no-custom-element approach.