In-App UI
React
Hooks
usePreferences
usePreferences
The usePreferences
hook is used to fetch and manage user notification preferences. This hook provides access to preference sets and allows you to update user preferences.
Parameters#
Accepts an object (UsePreferencesParams
) with the following properties:
preferenceSetstring
The preference set ID to fetch. If not provided, the default preference set will be fetchedReturns#
A UsePreferencesReturn
object with the following properties:
preferencesPreferenceSet
The preference set data including workflows and channelsisLoadingboolean
Whether preferences are being loadederrorError | null
Error object if the request failedupdatePreferences(updates: PreferenceUpdate) => Promise<void>
Function to update user preferencesExample#
Basic usage#
The following example demonstrates how to use the usePreferences
hook to manage user preferences.