CometChat Developer Documentation

Welcome Ninja!

You'll find comprehensive guides and documentation to help you start working with CometChat as quickly as possible. Let's jump right in!

Get Started    

User Management

Users can be created using one of the below 3 methods:

On-the-fly

To create the users on the go, we provide a method in the Android SDK called createUser(). You can use the method to create a user as shown in the below code sample:

private String UID = "DEMO123";  // Required
private String name = "Your Name";  // Required
private String avatarURL = "";
private String profileURL = "";
private String role = "";
private Context context;

cometChat.createUser(context,UID,name,avatarURL,profileURL,role,new Callbacks() {
	@Override
	public void successCallback(JSONObject jsonObject) {
  
  }
	@Override
	public void failCallback(JSONObject jsonObject) {
  
  }
});

This method will create the user with the parameters passed if everything is successful and return the details of the user created in the successCallback.
In case the user already exists, it will return an error message saying "User already exists".

Via Restful API

The second option available to create a user is using the Restful APIs we provide for user management.

Via Admin Panel

The third and the most simple option to create users is by creating the users via the CometChat Administration Panel. All you need to do is login to the CometChat Admin Panel, and navigate to the Users section in the left pane.

User Management