Skip to main content
There are two objects, and they are not the same thing.

window.peeve

The running widget, lowercase. Available once widget.js has booted. This is what the script tag gives you.

Peeve

The npm package export, capital. import { Peeve } from "@peeve/sdk". It boots the widget and forwards calls to it.
Use whichever matches how you installed. If you use the package, prefer Peeve — it queues calls made before the widget has loaded, which window.peeve cannot do because it does not exist yet.

window.peeve

identify(user)

Record who the signed-in user is.
Extra keys are accepted, but business context belongs in setContext, which is built for it. Returns the widget, so calls chain.

setContext(ctx)

Attach any business context to the current user, as open key/value.
Merged across calls — the last value for a key wins. Plaintext and non-secret. See Identity and context for what goes where.

open()

Open the ask panel programmatically, for your own “Get help” button.
Boots the widget first if it has not started. Focuses the panel if it is already open.

init(options)

Mount the widget manually. You do not normally need this — the script tag auto-boots — but it lets you pass options that have no script attribute.
Idempotent: calling it after auto-boot does nothing, so it cannot double-mount. Script tag options underlie programmatic ones field by field, so a bare tag plus a partial init() keeps both. Useful options:
Several flags are server-decided and cannot be turned on from the page — your page can only turn them off. booking, liveChatEnabled, escalationEnabled, interventionEnabled and npsEnabled come from the server, because they depend on your plan, your connectors and whether a teammate is actually available. Setting booking: true locally will not make the slot picker appear.

state

A read-only snapshot, useful when debugging.

destroy()

Tear the widget down and remove it from the page.

Peeve (npm package)

Peeve.init({ publishableKey, name? })

Boot the widget. Throws if publishableKey is missing. No-op during SSR.

Peeve.identify(userIdOrTraits, traits?)

Two call shapes, both equivalent:
Note the field is userId here, where the widget’s own identify uses id. The package maps between them. Accepts userId, email, name, company, phone, plan, createdAt. createdAt may be an ISO string or epoch milliseconds — it is normalised for you. Calls made before the widget has loaded are queued and flushed when it appears (the package polls for about 20 seconds, then gives up).

Peeve.setContext(ctx)

Merged across calls. SSR-safe.

Peeve.reset()

Clear the identity and context. Call this on logout — otherwise the next person to use that browser inherits the previous user’s identity.
window.peeve has no reset(). From the raw widget, clear identity by calling the underlying identify(null); if you are managing sessions, use the package, where reset() is the supported path.

Framework examples