In-App UI
JavaScript
SDK
UserClient

UserClient reference

Complete reference for the UserClient in the Knock JavaScript SDK.

Client for interacting with user-related operations in the Knock API.

Methods

#

get

#

Retrieves the current, authenticated user by calling the get user endpoint directly from the client.

Returns: Promise<ApiResponse>

Example:

identify

#

Identifies a user by calling the identify user endpoint directly from the client.

Parameters:

propertiesobject
An object of key-value pairs for attributes you want to associate with the user.

Returns: Promise<ApiResponse>

Example:

getAllPreferences

#

Retrieves all preferences for the authenticated user by calling the get preferences endpoint directly from the client.

Returns: Promise<ApiResponse>

Example:

getPreferences

#

Retrieves a preference set for the authenticated user by calling the get preferences endpoint directly from the client.

Parameters:

preferenceSetString
The preference set from Knock
tenantString (optional)
The tenant from Knock

Returns: Promise<ApiResponse>

Example:

setPreferences

#

Updates the authenticated user's preferences by calling the set preferences endpoint directly from the client.

Parameters:

preferenceSetSetPreferencesProperties
The preferences to set for the current user.

Returns: Promise<ApiResponse>

Example:

getChannelData

#

Retrieves channel data for the authenticated user by calling the get channel data endpoint directly from the client.

Parameters:

channelIdString
The channel ID from Knock

Returns: Promise<ApiResponse>

Example:

setChannelData

#

Updates the channel data for the current user by calling the set channel data endpoint directly from the client.

Parameters:

channelIdString
The channel ID to update the channel data for
channelDataAny
The data to update for the channel data

Returns: Promise<ApiResponse>

Example: