Roles

Roles are assigned to each user created in CometChat. default role is assigned to the user by default if the role is not provided explicitly.

The following table lists the properties that the Role API supports.

ParametersTypeDescription
rolestring(mandatory) Specifies role's unique ID. Maximum length is 100 characters.

Allowed characters: alpha-dash (a-z, 0-9 with -and _ ) without spaces
name string(mandatory) Specifies the role's name.
Maximum length is 100 characters.
description string(optional) Specifies the description of the user.
If left empty, no description is set for the role.

Maximum length is 255 characters.
metadata nested object(optional) Specifies a JSON object to store up to 1.6K characters (JSON stringified metadata) for additional role information.
settings array(optional) Role settings that is used for restricting list users/send message API.
Possible values for listUsers & sendMessagesTo are all and friendsOnly
settings.listUsers string(optional) Restricts users listing to either all OR friendsOnly for all users with this role.

possible values: all, friendsOnly
settings.sendMessagesTostringRestricts sending message to either all OR friendsOnly for all users with this role.
possible values: all, friendsOnly