InvergeDocs
JavaScriptAPI reference

Surveys

Surveys in the JavaScript SDK.

// access
nexus.surveys
SymbolKindSummary
ActiveOptionsinterface
NexusSurveyinterface
NexusSurveysclassIn-product surveys — fetch eligible surveys and submit answers.

ActiveOptions

interface

properties

property
properties?: Record<string, unknown>

deviceType

property
deviceType?: string

NexusSurvey

interface

id

property
id: string

name

property
name: string

type

property
type: string

questions

property
questions: unknown[]

NexusSurveys

class

In-product surveys — fetch eligible surveys and submit answers. Headless (bring your own UI); works in any framework and server-side.

NexusSurveys

constructor
new NexusSurveys(http: NexusHttp, id: NexusIdentity)

Parameters

Prop

Type

Returns NexusSurveys

View source

active

property
readonly active: NexusSurvey[]

fetch()

method
async fetch(options: ActiveOptions = {}): Promise<NexusSurvey[]>

Surveys the current user is eligible for (targeting/sampling/capping applied).

Parameters

Prop

Type

Returns Promise<NexusSurvey[]>

View source

byId()

method
byId(id: string): NexusSurvey | undefined

Parameters

Prop

Type

Returns NexusSurvey | undefined

View source

respond()

method
async respond(surveyId: string, answers: Record<string, unknown>, options: { responseId?: string; completed?: boolean; dismissed?: boolean; iterationKey?: string } = {}): Promise<void>

Submit a response (partial, complete, or dismissed). Answers keyed by question id.

Parameters

Prop

Type

View source

complete()

method
complete(surveyId: string, answers: Record<string, unknown>, options: {} = {}): Promise<void>

Parameters

Prop

Type

View source

dismiss()

method
dismiss(surveyId: string, options: {} = {}): Promise<void>

Parameters

Prop

Type

View source

On this page