Skip to content

Handle group chat permissions

Robust group chat permissions are key to providing users with a friendly and safe group chat experience.

Available permissions and options

These are the permissions allowed for a group:

  • Add member
  • Remove member
  • Update metadata
  • Add admin
  • Remove admin
  • Update permissions

These are the permission options available for each permission:

  • Unspecified
  • Allow
  • Deny
  • Allow if admin or super admin
  • Allow if super admin

You can list, add, and remove members from a group chat. Only the group chat creator (super admin) has permission to add or remove members. This restriction ensures that only authorized individuals can modify the participant list.

Manage group chat admins

There are two kinds of administrators: super admins and admins. The group creator starts as a super admin, who has the most permissions so that a normal admin cannot remove the creator or destroy a group.

Here's an overview of how group chat admin statuses work:

  • Everyone in a group chat is a member.
  • A member can be granted admin or super admin status.
    If the member's admin or super admin status is removed, they are still a member of the group chat.
  • By default, only a member with super admin can add and remove admin and super admin statuses.
    Also by default, the group creator is the only member with super admin status.

Check if inbox ID is an admin

React Native
// Assume group is an existing group chat object for client
const isAdmin = await.group.isAdmin(adminClient.inboxID)

Check if inbox ID is a super admin

React Native
//Assume group is an existing group chat object for client
const isSuperAdmin = await group.isSuperAdmin(client.inboxID);

List admins

React Native
await group.listAdmins();

List super admins

React Native
await group.listSuperAdmins();

Add admin status to inbox ID

React Native
await group.addAdmin(client.inboxID);

Add super admin status to inbox ID

React Native
await group.addSuperAdmin(client.inboxID);

Remove admin status from inbox ID

React Native
await group.removeAdmin(client.inboxID);

Remove super admin status from inbox ID

React Native
await group.removeSuperAdmin(client.inboxId);

Manage group chat membership

Add members by inbox ID

React Native
await group.addMemberInboxIds([inboxId]);

Add members by address

React Native
await group.addMembers([walletAddress]);

Remove members by inbox ID

React Native
await group.removeMemberInboxIds([inboxId]);

Remove members by address

React Native
await group.removeMembers([walletAddress]);

Get inbox IDs for members

React Native
await group.memberInboxIds();

Get addresses for members

React Native
const members = await group.members();
const addresses = members.map((member) => member.addresses);

Get the inbox ID that added the current member

React Native
// this API is experimental and may change in the future
 
const addedByInboxId =await group.addedByInboxId();