Privacy SettingsUSER-ONLY

User clients can control who can see account information and use features such as calls and group invitations.

Getting Privacy Rules

Use getPrivacySetting with a PrivacySettingKey to get PrivacyRule objects.

const rules = await client.getPrivacySetting("phoneNumber");

for (const rule of rules) {
  console.log(rule);
}

Setting Privacy Rules

Use setPrivacySetting with InputPrivacyRule objects. This example makes the profile photo visible to contacts only.

await client.setPrivacySetting("profilePhoto", [
  { type: "contacts", isAllowed: true },
  { type: "everybody", isAllowed: false },
]);

Adding User Exceptions

Use a users rule to add exceptions. This example hides the last seen time from everybody except one user.

await client.setPrivacySetting("lastSeen", [
  { type: "users", usersId: [userId], isAllowed: true },
  { type: "everybody", isAllowed: false },
]);