Skip to main content
Use the web widget to add chat to your website and route messages to your configured widget agents.

Install

You can find the widget token in Dashboard -> Widgets -> your widget -> Embed.

Layout Modes

Set layout in Dashboard -> Widgets -> Appearance -> Layout, or pass layout in the script.
  • bubble: Default floating launcher bubble.
  • tab: Vertical side tab launcher.
  • If layout is not provided, it defaults to bubble.

Constructor Options

  • widgetToken (required): Widget token from Dashboard.
  • layout (optional): bubble or tab (default: bubble).
  • bottomSpacing (optional): Distance in pixels from the page bottom (default: 28).

Bottom Spacing Example

JavaScript API

After creating a widget instance, you can control it programmatically:
  • widget.init(): Initialize the widget and load config from your widget token.
  • widget.open(): Open chat UI (also makes a hidden widget visible).
  • widget.close(): Close chat UI.
  • widget.toggle(): Toggle between open and closed.
  • widget.show(): Show widget UI if hidden.
  • widget.hide(): Hide widget UI.
  • widget.identify(params): Identify a logged-in user and link chat activity to their contact.
  • widget.resetIdentity(): Clear the stored identity (for example, on logout).
  • widget.destroy(): Remove widget DOM and event listeners.

Identify Logged-In Users

Use identify() when a visitor is signed into your product. Simple links widget conversations and activity to that contact so agents and teammates see the right person.

Without identity verification

If identity verification is not enabled on your widget, you can identify users with just their ID and optional profile fields:
identify() can be called before or after init(). If you call it early, the widget queues the request and sends it once initialization finishes.

Identify parameters

FieldRequiredDescription
idYesYour stable user ID (primary key). This is the value signed when using HMAC.
emailNoUser email address.
nameNoDisplay name.
phoneNoPhone number (E.164 recommended).
hmacWhen identity verification is enabledHex-encoded HMAC-SHA256 of id (see below).
metadataNoAdditional key/value attributes to store on the contact.

Authenticated Identity with HMAC

For production apps, enable identity verification so visitors cannot spoof another user’s identity from the browser. When identity verification is enabled on a widget, every identify() call must include a valid HMAC. Simple rejects identify requests that omit the HMAC or pass an invalid signature.

How it works

  1. Your backend signs the user’s ID with your widget identity verification secret.
  2. Your frontend receives that HMAC from your backend (for example, as part of the session payload).
  3. Your page calls widget.identify({ id, hmac, ... }).
  4. Simple verifies the HMAC before accepting the identity.
Never put the identity verification secret in frontend code. Only your server should generate the HMAC.

Generate the HMAC on your server

The HMAC is HMAC-SHA256 of the user id, using your identity verification secret as the key. The digest must be hex-encoded.

Node.js

Python

Ruby

The string you sign must be exactly the same id string you pass to identify().

Pass the HMAC to the widget

  1. User signs into your app.
  2. Your backend loads the current user and generates hmac = HMAC-SHA256(user.id, secret).
  3. Your page renders (or fetches) id, profile fields, and hmac.
  4. Initialize the widget and call identify() with those values.
  5. On logout, call resetIdentity().

Security notes

  • Sign only the user id (not email/name/phone). Profile fields are traits; the HMAC authenticates identity.
  • Keep the identity verification secret server-side only (environment variable or secrets manager).
  • Rotate the secret if it is ever exposed, then redeploy backend code that generates HMACs.
  • If identity verification is enabled and the HMAC is missing or invalid, identify fails and the visitor stays anonymous.
Contact your Simple account team if you need identity verification enabled for a widget and an identity verification secret issued.

Tab Layout Example