Skip to content

Installation

Install the SDK from npm:

npm install @usesophi/sophi-web-sdk

Package page:

Import and create widget

import { SophiWidget } from "@usesophi/sophi-web-sdk";

const widget = new SophiWidget();

Initialize

await widget.init({
  apiKey: "YOUR_SOPHI_API_KEY",
  container: "#sophi-widget-container",
  userId,
  userName,
  environment: "production",
});

Note

If your project loads the SDK through GTM instead of npm, see GTM Integration.