Widget embed

Load the script, init with a minted session, and let ChatAdmin branding fill in bot name, color, and welcome message for your systemName.

Recommended init

Embed patterns

<?php if (!empty($_SESSION['userCode'])): ?>
<?php
  $sessionSignature = getMimmoSessionSignature(
    BOT_SYSTEM_NAME,
    isset($_SESSION['companyCode']) ? (string)$_SESSION['companyCode'] : null,
    $_SESSION['userCode'],
    $_SESSION['userName'] ?? null
  );
?>
<script src="<?= htmlspecialchars(BOT_API_URL) ?>/chat-widget.js"></script>
<script>
  window.Mimmo("init", {
    tenantToken: <?= json_encode($sessionSignature ?? '') ?>,
    systemName: <?= json_encode(BOT_SYSTEM_NAME) ?>
  });
</script>
<?php endif; ?>

Init options

KeyRequiredNotes
tenantTokenyesMint signature — not the long-lived env token
systemNameyesSelects knowledge + branding
signaturealiasMapped to the same session field; prefer tenantToken
userCode / companyCodenoDisplay-only fallbacks; real identity lives in the minted session

Data attributes (legacy / progressive)

You may also use data-signature + data-system on the script tag. Never put the raw ChatAdmin widget token in data-signature or data-tenant-token.

Session expiry

  • Mint per page load.
  • Widget extend keeps short sessions alive while the tab is active (/api/chat/token/extend).
  • On hard expiry, ask the user to refresh rather than silently attaching the wrong user.

Sandbox

ChatAdmin → Widget → Open Sandbox mints with your tenant token for manual QA. Production hosts must use the server-side pattern in Quickstart.