Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
69 lines (60 loc) · 9.11 KB

File metadata and controls

69 lines (60 loc) · 9.11 KB

Set Preferences

HTTP MethodURLRequires Auth
POST/api/v1/users.setPreferencesyes

{% hint style="info" %} If you want to edit another user's preferences, you need the permission edit-other-user-info. {% endhint %}

Body Parameters

KeyExample ValueDescription
userIdBsNr28znDkG8aeThe 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.
languageenThe preferred language for the user.
newRoomNotificationdoorNew room notification sound.
newMessageNotificationchimeNew message notification sound.
muteFocusedConversationstrueA boolean value that indicates whether the user has enabled the option to mute focused conversations.
clockMode1

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
useEmojistrueA boolean value that indicates whether the user has enabled the option to use emojis.
convertAsciiEmojitrueA boolean value that indicates whether the user has enabled the option to convert ASCII emojis.
saveMobileBandwidthtrueA boolean value that indicates whether the user has enabled the option to save mobile bandwidth.
collapseMediaByDefaulttrueA boolean value that indicates whether the user has enabled the option to collapse media by default.
autoImageLoadtrueA boolean value indicates whether the user has enabled the option to load images automatically.
emailNotificationModementionsThe preferred mode for email notifications.
unreadAlerttrueA boolean value indicates whether the user has enabled the option.
notificationsSoundVolume100The sound volume for notifications.
desktopNotificationsmentions

The type of desktop notifications.

  • all: Get desktop notifications for all messages.
  • mentions: Get the notifications only for mentions.
  • nothing: Get no desktop notifications.
pushNotificationsmentions

The mobile push notification.

  • all: Get mobile notifications for all messages.
  • mentions: Get the notifications only for mentions.
  • nothing: Get no mobile notifications
enableAutoAwayfalseA 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.
messageViewMode1

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

  • 0 - Normal
  • 1 - Cozy
  • 2 - Compact
hideUsernamestrueA boolean value that indicates whether the user has enabled the option to hide usernames.
hideRolestrueA boolean value that indicates whether the user has enabled the option to hide roles.
displayAvatarstrueA boolean value that indicates whether the user has enabled the option to display user avatars.
hideFlexTabtrueA boolean value that indicates whether the user has enabled the option.
sendOnEnternormal

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.
idleTimeLimit300The time limit that is to be considered as idle time.
sidebarShowFavoritestrueA boolean value that indicates whether the user has enabled the option to show favorites on the sidebar.
sidebarShowUnreadtrueA boolean value that indicates whether the user has enabled the option to show unread messages in the sidebar.
sidebarSortbyactivity

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

  • activity
  • alphabetical
sidebarViewModecondensed

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

  • extended
  • medium
  • condensed
sidebarDisplayAvatartrueA boolean value that indicates whether the user has enabled the option to display avatars in the sidebar.
sidebarGroupByTypetrueA 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"
        }
    },
Version Description
2.3.0 Added desktopNotificationRequireInteraction property.