In-App UI
JavaScript
SDK
ObjectClient

ObjectClient reference

Complete reference for the ObjectClient in the Knock JavaScript SDK.

Client for interacting with object channel data operations in the Knock API.

Constructor

#

Initializes a new object client instance.

Parameters:

instanceKnock
The Knock client instance to use for API requests.

Returns: ObjectClient

Methods

#

getChannelData

#

Retrieves channel data for a specific object in a collection.

Parameters:

objectIdstring
The unique identifier of the object.
collectionstring
The collection that contains the object.
channelIdstring
The channel ID to retrieve data for.

Returns: Promise<ChannelData<T>>

Type Parameters:

TGenericData
The expected shape of the channel data. Defaults to GenericData.

Example:

setChannelData

#

Sets or updates channel data for a specific object in a collection.

Parameters:

objectIdstring
The unique identifier of the object.
collectionstring
The collection that contains the object.
channelIdstring
The channel ID to set data for.
dataGenericData
The channel data to store for the object.

Returns: Promise<ApiResponse>

Example: