Install
Layout Modes
Set layout in Dashboard -> Widgets -> Appearance -> Layout, or passlayout in the script.
bubble: Default floating launcher bubble.tab: Vertical side tab launcher.- If
layoutis not provided, it defaults tobubble.
Constructor Options
widgetToken(required): Widget token from Dashboard.layout(optional):bubbleortab(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
Useidentify() 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
| Field | Required | Description |
|---|---|---|
id | Yes | Your stable user ID (primary key). This is the value signed when using HMAC. |
email | No | User email address. |
name | No | Display name. |
phone | No | Phone number (E.164 recommended). |
hmac | When identity verification is enabled | Hex-encoded HMAC-SHA256 of id (see below). |
metadata | No | Additional 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, everyidentify() call must include a valid HMAC. Simple rejects identify requests that omit the HMAC or pass an invalid signature.
How it works
- Your backend signs the user’s ID with your widget identity verification secret.
- Your frontend receives that HMAC from your backend (for example, as part of the session payload).
- Your page calls
widget.identify({ id, hmac, ... }). - Simple verifies the HMAC before accepting the identity.
Generate the HMAC on your server
The HMAC is HMAC-SHA256 of the userid, using your identity verification secret as the key. The digest must be hex-encoded.
Node.js
Python
Ruby
id string you pass to identify().
Pass the HMAC to the widget
Recommended end-to-end flow
- User signs into your app.
- Your backend loads the current user and generates
hmac = HMAC-SHA256(user.id, secret). - Your page renders (or fetches)
id, profile fields, andhmac. - Initialize the widget and call
identify()with those values. - 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.