JavaScript SDK Reference

The main createClient(), flow, identity, and configure surfaces exposed by @getuserfeedback/sdk.

Last reviewed

JavaScript SDK Reference

The JavaScript SDK revolves around one client created with createClient().

Core client methods

  • createClient({ apiKey, colorScheme, disableAutoLoad, disableTelemetry, defaultConsent })
  • client.identify(userId, traits?) or client.identify(traits)
  • client.reset()
  • client.flow(flowId)
  • client.configure({ auth, consent, colorScheme })
  • client.close()
  • client.setDefaultContainerPolicy(policy)
  • client.subscribeFlowState(callback, options?)
  • client.onOpenRequested(callback)

Flow handle methods

client.flow(flowId) gives you a reusable handle for:

  • open()
  • prefetch()
  • prerender()
  • setContainer(element | null)
  • close()
  • getFlowState()
  • subscribeFlowState(callback, options?)

Use the flow handle when you want to warm the experience before opening it or keep the lifecycle tied to one specific flow instance.