SDK REFERENCE · V1

Browser API and integration contract

The public SDK is framework-neutral. React uses the same underlying state, actions, modules, and lifecycle.

Start with the quickstart
INITIALIZE

init(options)

Validates the key and host domain, loads surface configuration, mounts the launcher, and resolves with the public configuration.

keystring
Publishable surface key. Required unless supplied by the hosted script.

originstring
Demoloop application origin. Defaults to https://getdemoloop.com.

labelstring
Override the launcher-button label.

position"left" | "right"
Launcher position.

mode"modal" | "popup"
Default presentation.

userDemoloopUser
Initial signed-in user and account traits.

contextDemoloopContext
Initial page, tenant, use-case, metadata, and software-map context.

actionsRecord<string, handler | route>
Initial allow-list of explicit host actions.

modulesDemoloopModule[]
Independently launchable experiences.

visitorActionsDemoloopVisitorAction[]
Visitor-facing next steps such as booking, contact, or custom sales links.

actionTimeoutMsnumber
Default host-action timeout, clamped between 1 and 30 seconds.

IDENTITY AND CONTEXT

Personalize the product demo

identify(user)Merges id, email, name, company, role, and bounded traits into the current identity.

setContext(context)Merges page URL, path, title, product area, tenant, use case, metadata, and an optional software map.

track(name, properties)Adds a timestamped product event. The most recent events are synchronized with the hosted experience.

Do not include passwords, access tokens, private API keys, health information, payment data, or other unnecessary sensitive information.

ACTIONS

Explicit host capabilities

registerAction(name, handler)Add or replace one named action.

setActions(actions)Replace the entire action allow-list.

handler(request, { signal })Receives the action target, kind, reason, payload, optional path, and an AbortSignal.

string routeNavigation shorthand restricted to the current host origin.

Return false to reject.

Return an object to attach success data.

Observe the AbortSignal for timeout or cancellation.

Keep destructive actions behind application confirmation and authorization.

VISITOR ACTIONS

setVisitorActions(actions)

Offer one clear next step across the demo without building a provider-specific integration. Dashboard presets cover common scheduling tools; the same contract accepts any safe HTTPS, email, or phone destination.

typebook_meeting, contact_sales, open_url, or a future module action.

labelThe visitor-facing button text.

urlThe external sales or scheduling destination.

openInnew_tab or same_tab.

placementstopbar, handoff, and/or completion.

MODULES

setModules(modules)

idStable module identifier used by open({ module }).

labelOptional visitor-facing label.

experienceHosted experience identifier, such as demo or video-call.

presentationmodal or popup.

availableSet to false to reject launch attempts.

OPEN AND LIFECYCLE

Presentation and subscriptions

open({ module, experience, presentation })Launch a configured module or the surface default.

close()Close the modal experience.

on(event, listener)Subscribe and receive an unsubscribe function.

off(event, listener)Remove a known listener.

getState()Read the synchronized identity, context, events, actions, modules, launch state, client id, protocol version, and configuration.

destroy()Remove the launcher and open experience, abort actions, and reset SDK state.

Lifecycle events: ready, open, close, identify, context, track, actions, modules, action, error, destroy.

REACT

React entry point

DemoloopProviderInitializes the SDK with the component lifecycle. Set destroyOnUnmount when that provider owns the complete SDK lifetime.

useDemoloop()Returns readiness, error state, and the SDK methods.

useDemoloopEvent(event, listener)Subscribe to one lifecycle event without manual cleanup.