Skip to main content

Group permissions overview

These APIs help in validating if you have permissions for a gated group.

Get group permissions API

To determine if the permissions are granted to a user in a particular group.

// userAlice.chat.group.permissions(chatid)
const groupPermissions = await userAlice.chat.group.permissions(chatid);

Get group permissions parameters

ParamTypeDefaultRemarks
chatIdstring-The chatid related to that specific group. chatid are unique identifiers of the group

Note: Parameters in this style are mandatory.

Expected response
{
entry: true,
chat: true,
rules: { entry: { conditions: [] }, chat: { conditions: [] } }
}
ParamTypeRemarks
entrybooleanRefers if the Profile has access to enter the group
chatbooleanRefers if the Profile has access to chat in the group
rulesobjectModeration rules of the group

Modify Roles of members in a Group

This API can be used to change the roles of members within a group. By altering roles, you can adjust their permissions and access within the group.

// userAlice.chat.group.modify(chatid,{options})
const makeAdmins = await userAlice.chat.group.modify(chatid, {
role: "MEMBER", // Specify the new role here: "ADMIN" or "MEMBER"
accounts: [bobAddress], // Array of wallet addresses for the members whose roles are being changed
});

Get group permissions parameters

ParamTypeSubtypeDefaultRemarks
chatIdstring--The chatid related to that specific group. chatid are unique identifiers of the group.
optionsObject--Configuration object for specifying role changes.
-options.roleadmin or member-The new role to assign. Valid options: admin or member.
-options.accountsstring[]-Array of wallet addresses representing the members whose roles you want to modify.

Note: Parameters in this style are mandatory.

Expected response
{
"groupName": "Testing",
"groupDescription": "test",
"groupImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==",
"meta": null,
"scheduleAt": null,
"scheduleEnd": null,
"rules": {},
"status": null,
"isPublic": true,
"groupType": "default",
"chatId": "b575dc063b8bcf88962c6b91b83caa4d0901146b600a6c770ec0d32c501bfdb1",
"groupCreator": "eip155:0xb44a29524433dBC639C35124459c741bC241d4f4",
"encryptedSecret": null,
"sessionKey": null
}