Set Preferences

HTTP MethodURLRequires Auth

POST

/api/v1/users.setPreferences

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

Body Parameters

KeyExample ValueDescription

userId

BsNr28znDkG8ae

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*

"data": { ... }

The object with the following preference details.

language

en

The preferred language for the user.

newRoomNotification

door

New room notification sound.

newMessageNotification

chime

New message notification sound.

muteFocusedConversations

true

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

clockMode

1

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

true

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

convertAsciiEmoji

true

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

saveMobileBandwidth

true

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

collapseMediaByDefault

true

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

autoImageLoad

true

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

emailNotificationMode

mentions

The preferred mode for email notifications.

unreadAlert

true

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

notificationsSoundVolume

100

The sound volume for notifications.

desktopNotifications

mentions

The type of desktop notifications.

  • all: Get desktop notifications for all messages.

  • mentions: Get the notifications only for mentions.

  • nothing: Get no desktop notifications.

pushNotifications

mentions

The mobile push notification.

  • all: Get mobile notifications for all messages.

  • mentions: Get the notifications only for mentions.

  • nothing: Get no mobile notifications

enableAutoAway

false

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

["deploy", "docker"]

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.

messageViewMode

1

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

  • 0 - Normal

  • 1 - Cozy

  • 2 - Compact

hideUsernames

true

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

hideRoles

true

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

displayAvatars

true

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

hideFlexTab

true

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

sendOnEnter

normal

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

300

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

sidebarShowFavorites

true

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

sidebarShowUnread

true

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

sidebarSortby

activity

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

  • activity

  • alphabetical

sidebarViewMode

condensed

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

  • extended

  • medium

  • condensed

sidebarDisplayAvatar

true

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

sidebarGroupByType

true

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

dontAskAgainList

"dontAskAgainList":[{"action":"hideRoom","label":"Hide"}]

This field stores all the "warnings" a user opted not to be displayed again. An example where this works is when hiding a room.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type:application/json" \
     http://localhost:3000/api/v1/users.setPreferences \
     -d '{ "userId": "BsNr28znDkG8aeo7W", "data": { } }'

Example Result

// "settings": {
        "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"
        }
    },
VersionDescription

2.3.0

Added desktopNotificationRequireInteraction property.

Last updated

Rocket.Chat versions receive support for six months after release.