Skip to main content

Documentation Index

Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

In other words, as a logged-in user, how do I transfer the ownership of any group if I am the owner of the group? In order to transfer the ownership of any group, the first condition is that you must be the owner of the group. In case you are the owner of the group, you can use the transferGroupOwnership() method provided by the CometChat class. This will be helpful as the owner is not allowed to leave the group. In case, you as the owner would like to leave the group, you will have to use this method and transfer your ownership first to any other member of the group and only then you will be allowed to leave the group.
// Transfer group ownership
await CometChat.transferGroupOwnership("GUID", "NEW_OWNER_UID");
Note: Only the current group owner can transfer ownership. The owner must transfer ownership before leaving the group.
Transfer ownership of a group to another member. Only the current owner can do this, and since owners cannot leave their group, you must transfer ownership first if you want to leave. See Leave Group.

Transfer Ownership

Use transferGroupOwnership() to transfer ownership to another group member.
let GUID: string = "GUID";
let UID: string = "UID";
CometChat.transferGroupOwnership(GUID, UID).then(
  (ownershipTransferred: string) => {
      console.log("Successfully transferred ownership of the group.");
  }, error => {
      console.log("Could not transfer ownership of the group: ", error);
  }
);
ParameterDescription
GUIDThe GUID of the group
UIDThe UID of the member to become the new owner
On success, the method resolves with a success message string confirming the operation. The new owner gets admin scope and the previous owner becomes a participant.

Next Steps

Leave Group

Leave a group after transferring ownership

Change Member Scope

Promote or demote group members