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:
The client also fetches privacy settings automatically in the background right after connecting, purely to keep an internal cache current. Today the only setting cached this way is ReadReceipts, which gates the wire type of outgoing DM read/played receipts (see Read receipt privacy gating). That cache is written only by the automatic background fetch on connect — calling fetch_privacy_settings yourself is a bare passthrough that returns the current server-side values without touching device state, so it does not also refresh the cache. Call it directly when you need the full, current set of values, e.g. to render a settings screen; a reconnect (not a manual call) is what updates the cached read-receipts gate.

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.
Setting ReadReceipts to None takes effect on the next connect (the client re-fetches and re-caches the setting on each connect, matching WhatsApp Web, which reads it from local prefs) — calling fetch_privacy_settings yourself in the same session does not refresh that cache either (see the note above); a reconnect is currently the only way. From then on, mark_as_read/mark_as_played on a direct message send read-self/played-self instead of read/played, so the other party is no longer notified. This only applies to DMs — group, broadcast list, status-broadcast, and newsletter receipts are unaffected. See Read receipt privacy gating.

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