Skip to main content

Fetch Privacy Settings

Retrieve all current privacy settings for your account:
const privacySettings = await sock.fetchPrivacySettings(true)
console.log('privacy settings: ' + privacySettings)
Pass true to force refresh the settings, or false to use cached values. The function is implemented in src/Socket/chats.ts:119-134.

Privacy Value Types

Most privacy settings accept these values:
  • 'all' - Everyone can see
  • 'contacts' - Only your contacts can see
  • 'contact_blacklist' - Contacts except blocked ones
  • 'none' - Nobody can see

Update Last Seen Privacy

Control who can see when you were last online:
const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
await sock.updateLastSeenPrivacy(value)

Update Online Privacy

Control who can see when you’re online:
const value = 'all' // 'match_last_seen'
await sock.updateOnlinePrivacy(value)
Online privacy has two options: 'all' or 'match_last_seen' (same as last seen setting).

Update Profile Picture Privacy

Control who can see your profile picture:
const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
await sock.updateProfilePicturePrivacy(value)

Update Status Privacy

Control who can see your WhatsApp status/about:
const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
await sock.updateStatusPrivacy(value)

Update Read Receipts Privacy

Control whether you send read receipts (blue ticks):
const value = 'all' // 'none'
await sock.updateReadReceiptsPrivacy(value)
Disabling read receipts ('none') also prevents you from seeing others’ read receipts.

Update Groups Add Privacy

Control who can add you to groups:
const value = 'all' // 'contacts' | 'contact_blacklist'
await sock.updateGroupsAddPrivacy(value)
Groups add privacy only supports 'all', 'contacts', or 'contact_blacklist'. The 'none' option is not available.

Update Default Disappearing Mode

Set the default duration for disappearing messages in new chats:

Supported Times

TimeSeconds
Remove0
24h86,400
7d604,800
90d7,776,000

Example

const ephemeral = 86400 // 24 hours in seconds
await sock.updateDefaultDisappearingMode(ephemeral)

// Disable default disappearing mode
await sock.updateDefaultDisappearingMode(0)
The default is 7 days (604,800 seconds). Use WA_DEFAULT_EPHEMERAL constant which equals 7 * 24 * 60 * 60 seconds.

Privacy Functions Reference

All privacy update functions are implemented in src/Socket/chats.ts:
FunctionLineDescription
fetchPrivacySettings119-134Fetch all privacy settings
updateLastSeenPrivacy168-170Update last seen visibility
updateOnlinePrivacy172-174Update online status visibility
updateProfilePicturePrivacy176-178Update profile picture visibility
updateStatusPrivacy180-182Update status/about visibility
updateReadReceiptsPrivacy184-186Update read receipt settings
updateGroupsAddPrivacy188-190Update who can add to groups
updateDefaultDisappearingMode192-209Update default disappearing messages

Complete Example

// Fetch current settings
const settings = await sock.fetchPrivacySettings(true)
console.log('Current privacy settings:', settings)

// Update multiple privacy settings
await sock.updateLastSeenPrivacy('contacts')
await sock.updateOnlinePrivacy('match_last_seen')
await sock.updateProfilePicturePrivacy('contacts')
await sock.updateStatusPrivacy('contacts')
await sock.updateReadReceiptsPrivacy('all')
await sock.updateGroupsAddPrivacy('contacts')

// Set default disappearing messages to 24 hours
await sock.updateDefaultDisappearingMode(86400)
All privacy functions use the internal privacyQuery helper which sends IQ queries to WhatsApp servers with the appropriate XML namespace.