JavaScriptAPI reference
In-app messages
In-app messages in the JavaScript SDK.
// access
nexus.inApp| Symbol | Kind | Summary |
|---|---|---|
NexusInApp | class | In-app messages — OneSignal-style modals & banners. |
NexusInAppMessage | interface |
NexusInApp
classIn-app messages — OneSignal-style modals & banners. Messages are composed in the console; this service fetches the ones a user is eligible for (server- driven / headless UIs) and records impressions and clicks.
NexusInApp
constructornew NexusInApp(http: NexusHttp, id: NexusIdentity)Parameters
Prop
Type
Returns NexusInApp
active()
methodasync active(options: { distinctId?: string } = {}): Promise<NexusInAppMessage[]>The active in-app messages for the tenant.
Parameters
Prop
Type
Returns Promise<NexusInAppMessage[]>
trackEvent()
methodasync trackEvent(messageId: string, type: 'impression' | 'click' | 'dismiss', options: { buttonId?: string; distinctId?: string } = {}): Promise<void>Record an in-app message event: impression, click, or dismiss.
Parameters
Prop
Type
impression()
methodimpression(messageId: string, options: { distinctId?: string } = {}): Promise<void>Parameters
Prop
Type
click()
methodclick(messageId: string, buttonId: string, options: { distinctId?: string } = {}): Promise<void>Parameters
Prop
Type
dismiss()
methoddismiss(messageId: string, options: { distinctId?: string } = {}): Promise<void>Parameters
Prop
Type
NexusInAppMessage
interfaceid
propertyid: stringlayout
propertylayout: stringcontent
propertycontent: Record<string, unknown>buttons
propertybuttons?: unknown[]