Skip to main content
The privacy API allows you to fetch and update account-level privacy settings, such as who can see your last seen, profile photo, about text, and online status. All methods use type-safe enums for categories and values.

Access

Privacy operations are available directly on the Client:

Methods

fetch_privacy_settings

Fetch all current privacy settings.
Returns:
  • PrivacySettingsResponse - Contains a list of all privacy settings
Example:

set_privacy_setting

Update a specific privacy setting.
Parameters:
  • category - A PrivacyCategory enum variant
  • value - A PrivacyValue enum variant (must be valid for the category)
Returns:
  • SetPrivacySettingResponse - Contains an optional dhash field (present only for ContactBlacklist operations)
Example:
Each PrivacyCategory only accepts specific PrivacyValue variants. See the valid combinations table below.

set_privacy_disallowed_list

Update a privacy category’s disallowed list (contacts-except-specific-users mode). Only available for categories that support ContactBlacklist: Last, Profile, Status, and GroupAdd.
Parameters:
  • category - Must be Last, Profile, Status, or GroupAdd
  • update - A DisallowedListUpdate containing the dhash and user entries to add/remove
Returns:
  • SetPrivacySettingResponse - Contains the updated dhash for conflict detection
Example:

set_default_disappearing_mode

Set the default disappearing messages duration for all new chats.
Parameters:
  • duration - Timer in seconds. Common values: 86400 (24 hours), 604800 (7 days), 7776000 (90 days). Pass 0 to disable.
Example:
This sets the default for new chats only. Existing chats keep their current setting. To change disappearing messages for a specific group, use set_ephemeral.

Types

PrivacyCategory

Controls which privacy setting is being read or written. Each category maps to a wire-protocol string value.

PrivacyValue

The value assigned to a privacy category.

Valid category-value combinations

Not all values are valid for every category. Use PrivacyCategory::is_valid_value() to check at runtime.

PrivacySetting

PrivacySettingsResponse

Methods:
  • get(&self, category: &PrivacyCategory) -> Option<&PrivacySetting> - Look up a setting by category
  • get_value(&self, category: &PrivacyCategory) -> Option<&PrivacyValue> - Look up a value directly

SetPrivacySettingResponse

The dhash field is populated when setting a ContactBlacklist value or updating a disallowed list. Use it for conflict detection on subsequent updates.

DisallowedListUpdate

Used with set_privacy_disallowed_list to add or remove users from a category’s disallowed list.

DisallowedListUserEntry

DisallowedListAction

Common patterns

Fetch and display all settings

Maximum privacy configuration

Validate before setting

See also