Skip to main content

Configuration Reference

init(container, config) and el.setConfig(config) take the same shape. Partial setConfig() calls merge into prior values for strings, settings, and theme. Optional locale and getHeaders apply when those keys are present on the patch (each call can replace the previous programmatic value).

In React, this is the object you pass to the config prop.

Required

PropertyTypeDescription
apiUrlstringAbsolute GraphQL endpoint URL. Must use https: except local dev (http://127.0.0.1:PORT/… or http://localhost:PORT/…). Trailing slash is stripped by default (see apiUrlTrailingSlash).
accountNumberstringAccount identifier, e.g. A-B280147D.
userEmailstringUser handle (e.g. email) used as fromHandle when sending messages.

Optional

PropertyTypeDescription
apiUrlTrailingSlashbooleanWhen true, keep or add a trailing slash on apiUrl before each request. Default false (slash stripped).
getHeaders() => HeadersInit | Promise<HeadersInit>Per-request headers (e.g. Authorization). Called before every GraphQL request. Omit when using a same-origin proxy that attaches the token server-side — see Authentication.
localestringBCP 47 tag for message date/time (en-GB, fr-FR, …). Omit for browser default.
stringsInkLiveChatWidgetStringsAll user-facing copy. See Strings.
themePreset"dark" | "light"Built-in base palette. Default "dark". Individual theme keys override on top. See Theme.
themeInkLiveChatWidgetThemeColours, fonts, trigger position, sizing — override individual values on top of the preset. See Theme.
settingsInkLiveChatWidgetSettingsPoll interval, page size, throttles. See Settings.
onClose() => voidFires when the user completes the header close (X) flow: with an active thread, after confirm and a successful close; with no thread, when the panel collapses. Not fired for minimize or Escape.

Behaviour summary

What the widget handles for you once configured:

  • Persistence — the conversation id is stored in sessionStorage per account, so a reload resumes the thread.
  • Caching & de-duplication — pages are cached per conversation, and duplicate in-flight requests are coalesced.
  • Load older messages — scrolling to the top loads previous pages (throttled).
  • Scroll CTAs — a floating "scroll to bottom" button (with new-message count) appears when scrolled up.
  • Polling — while the panel is open. See Polling.
  • Error handling — send errors show a retry banner (input preserved); load errors show a retry UI.
  • Close flow — an active thread asks for confirmation before closing; the session clears only after a successful close.
  • Accessibility — ARIA roles and keyboard support (Enter to send, Shift+Enter for newline, Escape to dismiss).

Teardown

Removing the element from the DOM cleans up automatically. Call destroy() for explicit teardown — it returns a Promise.

CallBehaviour
await el.destroy()Removes the widget, stops polling/timers/observers, and clears in-memory state. The persisted conversation id in sessionStorage is unchanged (UI-only teardown).
await el.destroy({ closeConversation: true })Same, plus closes the conversation server-side if one exists. Clears sessionStorage only if the close succeeds. No in-widget confirmation (this is programmatic).

Because sessionStorage is left intact by default, a fresh mount can resume the existing thread.