UserPreference API class for managing Webex Contact Center user preferences. Provides functionality to get, create, update, and delete user preferences.

UserPreference

Example

import Webex from 'webex';

const webex = new Webex({ credentials: 'YOUR_ACCESS_TOKEN' });
const cc = webex.cc;

// Register and login first
await cc.register();
await cc.stationLogin({ teamId: 'team123', loginOption: 'BROWSER' });

// Get UserPreference API instance from ContactCenter
const userPreferenceAPI = cc.userPreference;

// Get user preferences for the current user
const preferences = await userPreferenceAPI.getUserPreference();

// Create new user preferences
const newPreferences = await userPreferenceAPI.createUserPreference({
userId: 'user123',
preferences: { e911Reminder: true }
});

// Update user preferences
const updatedPreferences = await userPreferenceAPI.updateUserPreference('user123', {
preferences: { e911Reminder: false }
});

// Delete user preferences
await userPreferenceAPI.deleteUserPreference('user123');

Constructors

  • Creates an instance of UserPreference

    Parameters

    • webex: WebexSDK

      The Webex SDK instance

    • getUserId: (() => string)

      Function to get the current user's CI user ID

        • (): string
        • Returns string

    Returns UserPreference

Properties

getUserId: (() => string)

Type declaration

    • (): string
    • Returns string

metricsManager: default
webex: WebexSDK
webexRequest: WebexRequest

Methods

  • Creates new user preferences

    Parameters

    Returns Promise<UserPreferenceData>

    Promise resolving to created user preferences

    Throws

    If the API call fails

    Example

    const newPreferences = await userPreferenceAPI.createUserPreference({
    userId: 'user123',
    preferences: { e911Reminder: true, notificationSettings: { email: true } }
    });
  • Deletes user preferences for a specific user

    Parameters

    • userId: string

      User ID to delete preferences for

    Returns Promise<void>

    Promise resolving when deletion is complete

    Throws

    If the API call fails

    Example

    await userPreferenceAPI.deleteUserPreference('user123');
    
  • Fetches user preferences for a specific user

    Parameters

    Returns Promise<UserPreferenceData>

    Promise resolving to user preferences

    Throws

    If the API call fails

    Example

    // Get preferences for current user
    const preferences = await userPreferenceAPI.getUserPreference();

    // Get preferences for a specific user
    const preferences = await userPreferenceAPI.getUserPreference({ userId: 'user123' });

    // Get preferences with pagination
    const preferences = await userPreferenceAPI.getUserPreference({ page: 0, pageSize: 50 });
  • Updates existing user preferences

    Parameters

    Returns Promise<UserPreferenceData>

    Promise resolving to updated user preferences

    Throws

    If the API call fails

    Example

    const updatedPreferences = await userPreferenceAPI.updateUserPreference('user123', {
    preferences: { e911Reminder: false }
    });