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.
Parameters | Type | Description |
---|---|---|
uid | string | (mandatory) Specifies user'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 user's name. Maximum length is 100 characters. |
avatar | string | (optional) Specifies the display picture of the user. If left empty, no display image is set for the user. Maximum length is 3000 characters. |
link | string | (optional) Specifies the URL to the profile page. Maximum length is 3000 characters. |
role | string | (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. |
metadata | nested object | (optional) Specifies a JSON object to store up to 1.6K characters (JSON stringified metadata) for additional user information. |
tags | array 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. |
withAuthToken | boolean | (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. |
createdAt | Integer | UNIX Timestamp indicates the time when the user was created. |