Skip to main content
This page documents all privacy-related methods available in the Baileys WhatsApp API.

Fetch Privacy Settings

fetchPrivacySettings

Fetch your current privacy settings.
force
boolean
default:false
Whether to force fetch from server (bypassing cache)
return
Promise<{ [key: string]: string }>
Returns an object with privacy settings:
  • last: Last seen privacy
  • online: Online status privacy
  • profile: Profile picture privacy
  • status: Status privacy
  • readreceipts: Read receipts setting
  • groupadd: Who can add you to groups
  • calladd: Who can call you
  • messages: Who can message you
const settings = await sock.fetchPrivacySettings()
console.log('Last seen:', settings.last)
console.log('Profile picture:', settings.profile)
console.log('Read receipts:', settings.readreceipts)

Block Management

fetchBlocklist

Fetch the list of blocked contacts.
return
Promise<string[]>
Returns an array of blocked JIDs
const blocked = await sock.fetchBlocklist()
console.log('Blocked contacts:', blocked)

updateBlockStatus

Block or unblock a contact.
jid
string
required
The JID of the contact
action
'block' | 'unblock'
required
Whether to block or unblock
// Block a contact
await sock.updateBlockStatus('[email protected]', 'block')

// Unblock a contact
await sock.updateBlockStatus('[email protected]', 'unblock')

Last Seen Privacy

updateLastSeenPrivacy

Control who can see your last seen timestamp.
value
WAPrivacyValue
required
Privacy setting:
  • 'all': Everyone can see
  • 'contacts': Only contacts can see
  • 'contact_blacklist': Contacts except blocked
  • 'none': Nobody can see
// Everyone can see
await sock.updateLastSeenPrivacy('all')

// Only contacts
await sock.updateLastSeenPrivacy('contacts')

// Nobody
await sock.updateLastSeenPrivacy('none')

Online Status Privacy

updateOnlinePrivacy

Control who can see when you’re online.
value
WAPrivacyOnlineValue
required
Privacy setting:
  • 'all': Everyone can see
  • 'match_last_seen': Same as last seen setting
// Everyone can see online status
await sock.updateOnlinePrivacy('all')

// Match last seen setting
await sock.updateOnlinePrivacy('match_last_seen')

Profile Picture Privacy

updateProfilePicturePrivacy

Control who can see your profile picture.
value
WAPrivacyValue
required
Privacy setting:
  • 'all': Everyone can see
  • 'contacts': Only contacts can see
  • 'contact_blacklist': Contacts except blocked
  • 'none': Nobody can see
// Everyone can see
await sock.updateProfilePicturePrivacy('all')

// Only contacts
await sock.updateProfilePicturePrivacy('contacts')

// Nobody
await sock.updateProfilePicturePrivacy('none')

Status Privacy

updateStatusPrivacy

Control who can see your status updates.
value
WAPrivacyValue
required
Privacy setting:
  • 'all': Everyone can see
  • 'contacts': Only contacts can see
  • 'contact_blacklist': Contacts except blocked
  • 'none': Nobody can see
// Everyone can see
await sock.updateStatusPrivacy('all')

// Only contacts
await sock.updateStatusPrivacy('contacts')

// Nobody
await sock.updateStatusPrivacy('none')

Read Receipts

updateReadReceiptsPrivacy

Control whether to send read receipts (blue ticks).
value
WAReadReceiptsValue
required
Privacy setting:
  • 'all': Send read receipts
  • 'none': Don’t send read receipts
// Enable read receipts
await sock.updateReadReceiptsPrivacy('all')

// Disable read receipts
await sock.updateReadReceiptsPrivacy('none')
Disabling read receipts means you also won’t see when others read your messages (with some exceptions for group chats).

Group Privacy

updateGroupsAddPrivacy

Control who can add you to groups.
value
WAPrivacyGroupAddValue
required
Privacy setting:
  • 'all': Everyone can add you
  • 'contacts': Only contacts can add you
  • 'contact_blacklist': Contacts except blocked can add you
// Everyone can add
await sock.updateGroupsAddPrivacy('all')

// Only contacts can add
await sock.updateGroupsAddPrivacy('contacts')

Call Privacy

updateCallPrivacy

Control who can call you.
value
WAPrivacyCallValue
required
Privacy setting:
  • 'all': Everyone can call
  • 'known': Only known contacts can call
// Everyone can call
await sock.updateCallPrivacy('all')

// Only known contacts
await sock.updateCallPrivacy('known')

Messages Privacy

updateMessagesPrivacy

Control who can message you.
value
WAPrivacyMessagesValue
required
Privacy setting:
  • 'all': Everyone can message
  • 'contacts': Only contacts can message
// Everyone can message
await sock.updateMessagesPrivacy('all')

// Only contacts can message
await sock.updateMessagesPrivacy('contacts')

Complete Privacy Setup Example

import makeWASocket from '@whiskeysockets/baileys'

const sock = makeWASocket({ /* auth config */ })

// Set all privacy settings at once
async function setupPrivacy() {
  // Fetch current settings
  const current = await sock.fetchPrivacySettings()
  console.log('Current settings:', current)

  // Configure privacy
  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')
  await sock.updateCallPrivacy('known')
  await sock.updateMessagesPrivacy('contacts')

  // Block unwanted contacts
  await sock.updateBlockStatus('[email protected]', 'block')

  console.log('Privacy settings updated!')
}

setupPrivacy().catch(console.error)

Privacy Types Reference

WAPrivacyValue

Used for: Last Seen, Profile Picture, Status
  • 'all' - Everyone
  • 'contacts' - My contacts
  • 'contact_blacklist' - My contacts except…
  • 'none' - Nobody

WAPrivacyOnlineValue

Used for: Online Status
  • 'all' - Everyone
  • 'match_last_seen' - Same as Last Seen

WAPrivacyGroupAddValue

Used for: Group Add Permission
  • 'all' - Everyone
  • 'contacts' - My contacts
  • 'contact_blacklist' - My contacts except…

WAPrivacyCallValue

Used for: Call Permission
  • 'all' - Everyone
  • 'known' - My contacts

WAPrivacyMessagesValue

Used for: Message Permission
  • 'all' - Everyone
  • 'contacts' - My contacts

WAReadReceiptsValue

Used for: Read Receipts
  • 'all' - Send read receipts
  • 'none' - Don’t send read receipts

Build docs developers (and LLMs) love