Set User Preferences
    • Dark
      Light
    • PDF

    Set User Preferences

    • Dark
      Light
    • PDF

    Article summary

    Post
    /api/v1/users.setPreferences

    If you want to edit another user's preferences, you need the permission edit-other-user-info.

    Changelog

    VersionDescription
    2.3.0Added desktopNotificationRequireInteraction property.
    Header parameters
    X-User-Id
    stringRequired

    The authenticated user ID.

    ExamplerbAXPnMktTFbNpwtJ
    X-Auth-Token
    stringRequired

    The authenticated user token.

    ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
    Body parameters
    Expand All
    object
    userId
    string

    The user ID whose preferences you want to change. If an ID is not provided, the preferences will be set for the user who is sending the request.

    data
    objectRequired

    The object with the following preference details.

    language
    string

    The preferred language for the user.

    Exampleen
    newRoomNotification
    string

    New room notification sound.

    Exampledoor
    newMessageNotification
    string

    New message notification sound.

    Examplechime
    muteFocusedConversations
    boolean

    A boolean value that indicates whether the user has enabled the option to mute focused conversations.

    clockMode
    integer

    The valid display formats for the clock. You can enter the values 0, 1, or 2.

    • 0: System default
    • 1: 12-hour clock
    • 2: 24-hour clock
    useEmojis
    boolean

    A boolean value that indicates whether the user has enabled the option to use emojis.

    convertAsciiEmoji
    boolean

    A boolean value that indicates whether the user has enabled the option to convert ASCII emojis.

    saveMobileBandwidth
    boolean

    A boolean value that indicates whether the user has enabled the option to save mobile bandwidth.

    collapseMediaByDefault
    boolean

    A boolean value that indicates whether the user has enabled the option to collapse media by default.

    autoImageLoad
    boolean

    A boolean value indicates whether the user has enabled the option to load images automatically.

    emailNotificationMode
    string

    The preferred mode for email notifications. The options are:

    • all: Get desktop notifications for all messages.
    • mentions: Get the notifications only for mentions.
    • nothing: Get no desktop notifications.
    Examplementions
    unreadAlert
    boolean

    A boolean value indicates whether the user has enabled the option.

    notificationsSoundVolume
    integer

    The sound volume for notifications.

    desktopNotifications
    string

    The type of desktop notifications.

    • all: Get desktop notifications for all messages.
    • mentions: Get the notifications only for mentions.
    • nothing: Get no desktop notifications.
    Examplementions
    pushNotifications
    string

    The type of push notifications.

    • all: Get push notifications for all messages.
    • mentions: Get the notifications only for mentions.
    • nothing: Get no push notifications.
    Examplementions
    enableAutoAway
    boolean

    A boolean value that indicates whether the user has enabled the option to update the status as away after a certain amount of idle time.

    highlights
    Array of string

    The message highlights section. You will be notified when someone mentions a word or phrase that you add here. Highlight words are not case-sensitive.

    string
    Example["deploy", "docker"]
    messageViewMode
    integer

    The preferred view mode for the messages. The available options are:

    • 0 - Normal
    • 1 - Cozy
    • 2 - Compact
    hideUsernames
    boolean

    A boolean value that indicates whether the user has enabled the option to hide usernames.

    hideRoles
    boolean

    A boolean value that indicates whether the user has enabled the option to hide roles.

    displayAvatars
    boolean

    A boolean value that indicates whether the user has enabled the option to display user avatars.

    hideFlexTab
    boolean

    A boolean value that indicates whether the user has enabled the option.

    sendOnEnter
    string

    Set how you want the Enter key to behave when sending messages.

    • normal - Send messages with the Enter key.
    • alternative - Send messages with Enter + Ctrl/Alt/Shift/Cmd.
    • desktop - Send messages with Enter only on the desktop.
    idleTimeLimit
    integer

    The time limit that is to be considered as idle time.

    Example300
    sidebarShowFavorites
    boolean

    A boolean value that indicates whether the user has enabled the option to show favorites on the sidebar.

    sidebarShowUnread
    boolean

    A boolean value that indicates whether the user has enabled the option to show unread messages in the sidebar.

    sidebarSortby
    string

    To sort the messages in the sidebar alphabetically or by activity. The values can be:

    • activity
    • alphabetical
    sidebarViewMode
    string

    The view mode of the sidebar. The values can be:

    • extended
    • medium
    • condensed
    sidebarDisplayAvatar
    boolean

    A boolean value that indicates whether the user has enabled the option to display avatars in the sidebar.

    sidebarGroupByType
    boolean

    A boolean value that indicates whether the user has enabled the option to show the grouped values in the sidebar.

    dontAskAgainList
    Array of object

    This field stores all the "warnings" a user opted not to be displayed again. An example where this works is when hiding a room. "dontAskAgainList":[{"action":"hideRoom","label":"Hide"}]"

    object
    Responses
    200

    OK

    Success Example
    {
      "preferences": {
        "enableAutoAway": true,
        "idleTimeLimit": 300,
        "desktopNotificationRequireInteraction": false,
        "desktopNotifications": "default",
        "pushNotifications": "all",
        "unreadAlert": false,
        "useEmojis": true,
        "convertAsciiEmoji": true,
        "autoImageLoad": true,
        "saveMobileBandwidth": true,
        "collapseMediaByDefault": false,
        "hideUsernames": false,
        "hideRoles": false,
        "hideFlexTab": false,
        "displayAvatars": true,
        "sidebarGroupByType": true,
        "sidebarViewMode": "condensed",
        "sidebarDisplayAvatar": true,
        "sidebarShowUnread": true,
        "sidebarSortby": "activity",
        "showMessageInMainThread": false,
        "sidebarShowFavorites": true,
        "sendOnEnter": "normal",
        "messageViewMode": 0,
        "emailNotificationMode": "mentions",
        "newRoomNotification": "door",
        "newMessageNotification": "chime",
        "muteFocusedConversations": true,
        "notificationsSoundVolume": 100,
        "enableMessageParserEarlyAdoption": false,
        "mobileNotifications": "default",
        "desktopNotificationDuration": 0,
        "dontAskAgainList": [],
        "highlights": [],
        "language": "en"
      }
    }
    Expand All
    object
    user
    object
    _id
    string
    settings
    object
    preferences
    object
    enableAutoAway
    boolean
    idleTimeLimit
    integer
    desktopNotificationRequireInteraction
    boolean
    desktopNotifications
    string
    pushNotifications
    string
    unreadAlert
    boolean
    useEmojis
    boolean
    convertAsciiEmoji
    boolean
    autoImageLoad
    boolean
    saveMobileBandwidth
    boolean
    collapseMediaByDefault
    boolean
    hideUsernames
    boolean
    hideRoles
    boolean
    hideFlexTab
    boolean
    displayAvatars
    boolean
    sidebarGroupByType
    boolean
    sidebarViewMode
    string
    sidebarDisplayAvatar
    boolean
    sidebarShowUnread
    boolean
    sidebarSortby
    string
    showMessageInMainThread
    boolean
    sidebarShowFavorites
    boolean
    sendOnEnter
    string
    messageViewMode
    integer
    emailNotificationMode
    string
    newRoomNotification
    string
    newMessageNotification
    string
    muteFocusedConversations
    boolean
    notificationsSoundVolume
    integer
    enableMessageParserEarlyAdoption
    boolean
    mobileNotifications
    string
    desktopNotificationDuration
    integer
    dontAskAgainList
    Array of object
    object
    highlights
    Array of object
    object
    language
    string
    success
    boolean
    400

    Bad Request

    Example 1
    {
      "success": false,
      "error": "must have required property 'data' [invalid-params]",
      "errorType": "invalid-params"
    }
    object
    success
    boolean
    error
    string
    errorType
    string
    401

    Unauthorized

    Authorization Error
    {
      "status": "error",
      "message": "You must be logged in to do this."
    }
    object
    status
    string
    message
    string

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.