Skip to content

Handle user consent in group chat

In addition to permissions that enable designated members to add and remove members from a group chat, user consent preferences also apply.

User consent preferences enable a user to allow or deny contact from a group ID, inbox ID, or address in a group chat context.

For example, your app can check inboxId values using the isInboxIdAllowed() or isInboxIdDenied() functions. Then, based on your app's design and the user's settings, your app can determine how and whether a group chat and message should be displayed for a user.

User consent preferences also exist in the 1:1 chat context. To learn more, see Understand user consent.

Allow or deny contact by wallet in group chat

React Native
// Allow
await contact.allow([walletAddress]);
 
// Deny
await contact.deny([walletAddress]);

Allow or deny contact by inbox ID in group chat

React Native
// Allow
await contact.allowGroup([groupId]);
 
// Deny
await contact.denyGroup([groupId]);

Allow or deny contact by group chat ID

React Native
// Allow group
await contact.allowGroup([groupId]);
 
// Deny a group
await contact.denyGroup([groupId]);

Allow or deny contact from inbox ID

Enable a user to explicitly allow or deny contact from an inbox ID.

React Native
// Allow
await client.contacts.allowInboxes([client.inboxId]);
 
// Deny
await client.contacts.denyInboxes([client.inboxId]);

Check consent for group chat ID

Check if contact from a group chat ID is allowed or denied for a user.

React Native
// Check if contact by a group is allowed for a member
const isAllowed = await group.isGroupAllowed(groupId);
 
// Check if contact by a group is denied for a member
const isDenied = await group.isGroupDenied(groupId);

Check consent for inbox ID

Check if contact from an inbox ID is allowed or denied for a user.

React Native
await client.contacts.isInboxAllowed(client.inboxId);

Stream user consent

To learn how to stream user consent preferences, see Stream the consent list.

Synchronize user consent

To learn how to keep user consent preferences synchronized, see Synchronize user consent preferences.