JavaScript SDK

The Treliq JavaScript SDK is a lightweight (~10 KB gzipped) browser library that connects your application to the Treliq workflow engine. It handles user identification, event tracking, in-app content rendering, and offline event buffering.

What it does

  • Identifies users — links a browser session to a stable user ID
  • Tracks events — batched, retried on rate limit, queued offline
  • Renders in-app content — banners, modals, popovers, and tooltips driven by your workflows
  • Streams in real time — WebSocket connection for instant content delivery, with automatic polling fallback
  • Reports actions — feeds user interactions back into running workflows

Reference

API

The SDK exposes a single init() factory that returns a TreliqSDK instance with these methods:

MethodPurpose
identify(externalUserId, attributes?)Link the session to a user
track(eventName, properties?, options?)Fire an event
getInAppContent()Manually fetch any pending in-app content
reportAction(runId, actionId, result)Report a user action back to a workflow
reset()Clear identity (call on logout)
shutdown()Flush queues and tear down listeners

See Getting Started for a quick walk-through, or jump into any reference page on the left.