Exchange a signed claim for a browser session
POST/{public_key}/sessions/
Called from your server, never from the browser. It is the one portal endpoint that takes a signature, and the signature needs the project's identity secret - the same one the chat widget's userHash is keyed with, found in the dashboard under the widget's Identity settings.
user_hash = hex(hmac_sha256(key=identity_secret, message=external_id))Hand the returned token to the page you are rendering and send it back in X-Helpwing-Session on every other call here. It reaches exactly one customer's conversations, and it expires - when it does, ask your server for another, because your server is the only party that knows whether that person is still signed in.
There is no unverified mode. The widget can afford one, because a visitor who proves nothing still gets a conversation of their own; here an unproved claim would be a request to read a stranger's support history, so an unsigned or wrongly signed claim is refused outright.
The customer is matched on external_id. A first-time caller whose email matches a customer who has never been identified takes over that record - which is the point: the conversations they had by email before they ever signed in are the history the portal exists to show them. A record already carrying a different external_id is left alone.
Body
- external_idstringrequired
- The id your application knows this person by. The customer is matched on it, and it is the value the signature covers.
- user_hashstringrequired
- hex HMAC-SHA256 of `external_id`, keyed with the project identity secret.
- emailstring (email)
- Their address. Used the first time only, to take over the record they already had from before they ever signed in - the conversations the portal exists to show them.
- namestring
- Display name. Fills a blank on the record; it never overwrites what an agent corrected.
- metadataobject
- Free-form JSON merged into the customer's record: plan, account id, seat count. Signed by your server, so unlike a conversation's own metadata it is a fact rather than a claim.
Responses
- 201 — Session
- 403 — the error envelope · The signature does not match the user id.
- 404 — the error envelope · No project has that public key, or the conversation is not this customer's.