Skip to main content
Everything the widget exposes goes through one function:
It exists as soon as the queue stub runs, so you can call it before the widget has loaded — see Calling it before it loads. Calls are replayed in order once it does, with init applied first whatever position it was queued in.

Commands

Commands never return a value — a queued call has nothing to return yet. Read state through events instead.

Events

ready fires once per page load. Subscribe before boot — from the queue stub — or you may subscribe after it has already fired.

Identity verification

If your visitors sign in, tell us who they are. Their conversations then attach to that customer, and their history follows them from laptop to phone. Do it with a signature. Without one, identify() is a browser asserting an identity, and anyone who can open developer tools can assert somebody else’s.
1

Get the identity secret

Settings → Channels → Website chat → Security. It is shown once, on creation, and once again each time you rotate it. It starts with wc_sec_.
This is a server-side secret. If it reaches your frontend bundle, verification proves nothing, because the visitor can compute the signature themselves. Keep it where your API keys live.
2

Sign the user id on your server

userHash is an HMAC-SHA256 of the user id — the exact string you pass as userId — keyed with the secret, hex-encoded.
3

Pass it to the widget

Render the hash into the page for the signed-in user, and identify once after boot:
4

Require it

Once your site is signing, turn on Require a valid signature under Security. Until you do, unsigned claims are accepted but stored as unverified — usable context for an agent, never trusted for identity.

What “verified” changes

The third row is the point. Reuniting a browser with an existing identified visitor is what would let “identify as somebody else” become an account takeover, so it happens only on a signature we can check.

Attributes

attributes is free-form context an agent sees beside the conversation: plan, cart value, signup date. Scalars only — strings (truncated at 500 characters), numbers and booleans. Up to 30 keys. Nested objects are dropped. Don’t put anything in there you wouldn’t want an agent to read.

Signing visitors out

Call it wherever your own sign-out runs. It ends the session and mints a fresh anonymous one, so the next person at that computer cannot read the previous person’s conversation. Nothing is deleted — the thread stays in the inbox with its history intact.

Events for automations

Fires a webchat.event trigger for your automations. It is not stored: what makes an event useful is an automation acting on it, and a table of every page view on every customer’s site would be a cost with no reader.

Errors you might see

A conversation id that isn’t this visitor’s answers 404, not 403. That is deliberate: a 403 would confirm the conversation exists, which is exactly what someone guessing ids wants to learn.