You should create a User in CometChat to be able to initiate communication in the platform. Users can chat in either 1-1 or groups.
UIDs would be automatically converted to lowercase while creating a user.
The following table lists the properties that the User API supports.
ParametersTypeDescription
uidstring(mandatory)_ Specifies user’s unique ID. Maximum length is 100 characters.Allowed characters: alpha-dash (a-z, 0-9 with -and _ ) without spaces
namestring(mandatory)_ Specifies the user’s name. Maximum length is 100 characters.
avatarstring(optional)_ Specifies the display picture of the user. If left empty, no display image is set for the user.\Maximum length is 3000 characters.
linkstring(optional)_ Specifies the URL to the profile page.Maximum length is 3000 characters.
rolestring(optional)_ Indicates the role that is assigned to the user.The role must be created before-hand using the create role API.If role is not passed, then default role is assigned to the user.
metadatanested object(optional)_ Specifies a JSON object to store up to 1.6K characters (JSON stringified metadata) for additional user information.
tagsarray of strings(optional)_ Specifies a list of tags to be associated with certain users.Maximum of 25 tags can be associated with a single user.
withAuthTokenboolean(optional)_ Includes authToken of the created user in the response.If set to true, you do not have to make a separate API call to create authToken.
createdAtIntegerUNIX Timestamp indicates the time when the user was created.