Groups

Create Group

This API creates new group in CometChat.

Request body

Name Description Mandatory
action To create a new group, pass the value: creategroup Yes
api-key The API Key present in your CometChat Admin Panel Yes
grouid unique group ID Yes
groupname Unique group name Yes
grouptype Type of group 0-> Public group, 1-> Password protected group, 2-> Invitation only group Yes
grouppassword Optional parameter, If grouptype is 1 then it’s mendatory

Response

Success

{“success”:{“status”:”1000″, “roomid”:17, “message”: “Group created”, “guid”:”8″ }}

Failure

{“failed”: {“status”:”1007″, “message”:”Group name or type required: Type list 0: Public, 1:Password Protected, 2: Invitation only”}}

{“failed”: {“status”:”1007″, “message”:”Password required for password protected room”}}

{“failed”: {“status”:”1007″, “message”:”guid is not unique”}}

Delete Group

This API creates delete the group.

Request body

Name Description Mandatory
action To delete a group, pass the value: deletegroup Yes
api-key The API Key present in your CometChat Admin Panel Yes
grouid unique group ID Yes

Response

Success

{“success”:{“status”: “1000”, “message”: “Group deleted”}}

Failure

{“failed”: {“status”: “1007”, “message”: “Group does not exist”}}

Add Users To A Group

This API add users to specific group. You can pass single or multiple IDs of user or json array contaning IDs of users.

Request body

Name Description Mandatory
action To add a new users to groups, pass the value: addgroupusers Yes
api-key The API Key present in your CometChat Admin Panel Yes
groupid unique group ID Yes
users IDs of users for eg: users: 1, or users: 1,2,3 Yes

Response

Success

{“success”:{“status”: “1000”, “message”: “Users added successfully in group”}}

Failure

{“failed”: {“status”: “1007”, “message”: “Invalid guid”}}

{“failed”: {“status”:”1005″, “message”:”Invalid input”}}

{“failed”: {“status”:”1006″, “message”:”Failed to add users.”}}

Remove Users From A Group

This API remove users from specific group. You can pass single or multiple IDs of user or json array contaning IDs of users.

Request body

Name Description Mandatory
action To remove user from groups, pass the value: removegroupusers Yes
api-key The API Key present in your CometChat Admin Panel Yes
groupid unique group ID Yes
users IDs of users for eg: users: 1, or users: 1,2,3 Yes

Response

Success

{“success”:{“status”:”1000″, “message”: “Users removed successfully from the group”}}

Failure

{“failed”: {“status”: “1007”, “message”: “Invalid guid”}}

{“failed”: {“status”:”1005″, “message”:”Invalid input”}}

{“failed”: {“status”:”1006″, “message”:”Failed to remove users.”}}
  • Was this helpful?
  • Yes   No