Chatly: support chat

Connect Chatly from the catalog: chat events on the right person, and View replay and View person links on each conversation.

Embed
Preview of the card
<a href="https://lucidace.com/help/chatly"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/71bc51c2-fead-4d97-b509-04c206b18f5c/social-card.svg?v=3e7ae33eec8b" alt="Chatly: support chat" width="600" height="315"></a>

Chatly is the chat widget Lucida's own app uses for support. Lucida has a native Chatly connector in the catalog.

Connect Chatly (no code)

  1. In Chatly, create a workspace API key with workspace:read and workspace:write scopes.

  2. In Chatly, create a webhook endpoint for conversation.created, conversation.closed, conversation.reopened and survey.response_received, and turn on verified_identity_only. Chatly shows the endpoint's signing secret once.

  3. In Lucida, open Integrations, pick Chatly, paste the API key and the signing secret, and point the Chatly webhook endpoint at the connector's webhook URL. Optional settings: app_url (your Lucida UI host, default https://lucidace.com) and base_url (default https://api.chatlychat.com).

What you get:

Event

Chatly source

Properties

$chat_started

conversation.created

conversation_id, channel, status, assignee, $ai_conversation_id

$chat_resolved

conversation.closed

conversation_id, closed_by, channel (when Chatly sends it), $ai_conversation_id

$chat_reopened

conversation.reopened

conversation_id, previous_status, $ai_conversation_id

$chat_rated

survey.response_received with kind csat

conversation_id, csat (the rating number), survey_id, response_id, $ai_conversation_id

Message text, subject and the rating comment are never read. A rating that names no conversation, or is not a CSAT, is acknowledged and ignored.

  • The join key. The person is the first non-empty of the contact's principal, externalId, external_id, ext, in that order, and it must equal the Lucida distinct_id. With Atlas identity on both sides, Chatly's principal is the Atlas sub, which is what Lucida's distinct_id already is, so the person matches with no extra wiring (ext, the product's own user id such as a database cuid, is only used when nothing else is set). Without Atlas, pass the id you give Lucida identify as the contact's externalId. A visitor Chatly could not verify has no externalId, so the event is personless under conv_<conversation id>; with no identity verification in your Chatly workspace every event is personless, which is expected.

  • Anonymous visitors. Chatly's webhooks carry contact.id, contact.externalId, contact.identityVerified (and principal, external_id or ext when Chatly sends them); visitor custom attributes and page context are not part of the payload, so an anonymous chat cannot be joined to the visitor's anonymous Lucida person. It stays personless. To get the person, identify the visitor to Chatly with a verified identity (the same user id you pass to Lucida identify).

  • On each new conversation with a known person, Lucida writes two links to the conversation's external links (GET/PUT /v1/conversations/{id}/external-links; the body is {"links":[{"label","url"}]}): View replay opens the person's most recent session replay (/replays/<session id>, from their events in the last 30 days; the sessions list /sessions?distinct_id=<person> when none is found) and View person opens /persons/<person id>. Both are replaced on each run, never stacked, and other API-written links are kept. A failed write-back is logged and does not fail the delivery.

  • Disconnect. Deleting the connector makes its webhook URL answer 404 and stops the write-back; disabling it does the same. Chatly will then show failed deliveries until you remove or pause the endpoint in Chatly.

  • Deliveries are verified with Chatly's scheme: header X-Livechat-Signature: t=<unix>,v1=<hex>, HMAC-SHA256 over <t>.<raw body>, 5-minute tolerance. Chatly's secret rotation is a hard cut: rotate in Chatly and in the connector together.

To put the replay of the visitor's current session on the conversation, turn on the browser SDK handoff:

init("lc_pk_...", { replay: { supportWidgets: { chatly: true } } });

Once Chatly is on the page (web widget only), the SDK calls Chatly("setContext", { links: [{ label: "View replay", url }] }) with lucida.getReplayUrl(). Chatly shows visitor-written links apart from the workspace's own. Opening the link needs a Lucida login with replay access. You can also do the same yourself from your server with PUT /v1/conversations/{id}/external-links and {"links":[{"label":"Session replay","url": ...}]}. The details are in Support tools.

React Native

Chatly's React Native SDK has no setContext or links call, so the exact-replay link cannot be handed over from an Expo app. The connector's server-side View replay link (the person's latest session) and View person link work for every channel, including the app, as long as the user is identified to Chatly.

Alternative: the webhook preset

If you would rather not use the connector, Chatly conversation and CSAT events can flow into Lucida through a webhook source with the preset chatly:

curl -X POST https://<your-lucida>/v1/projects/<project-id>/webhook-sources \
  -H "Authorization: Bearer <token>" -H "Content-Type: application/json" \
  -d '{"name":"Chatly","mapping":{"preset":"chatly"},"auth":{"mode":"chatly","secret":"<signing secret>"}}'
  1. In Chatly, create a webhook endpoint for the analytics events (conversation.created, conversation.closed, survey.response_received) pointing at the source URL from the answer, with the same secret. Turn on verified_identity_only.

  2. Deliveries are verified in chatly mode: the x-livechat-signature header t=<unix>,v1=<hex> is an HMAC-SHA256 over <t>.<raw body>, with a 5-minute timestamp tolerance. It is not a plain body HMAC, so the generic hmac mode will not verify it.

  3. conversation.created and conversation.closed arrive as events named after the type (conversation.created, not $chat_started) with $ai_conversation_id (and status, channel (from Chatly's channelType) on created); message text is never read. survey.response_received with kind csat arrives as a plain csat.submitted event (rating from score, kind, survey_id, response_id, comment_length (the length only, never the comment text), $ai_conversation_id). Other types are acknowledged and ignored.

  4. The person is the contact's principal, else externalId, external_id, ext (first non-empty). Without one the event is personless under conv_<conversation id>.

Chatly's secret rotation is a hard cut: there is no overlap window, so rotate the secret in Chatly and in the Lucida source together, or deliveries fail until both match.

Updated