AI Integration Quick Reference
AI Integration Quick Reference
Create a Group
UsecreateGroup() with a Group object. The groupType must be one of:
CometChatConstants.GROUP_TYPE_PUBLICCometChatConstants.GROUP_TYPE_PASSWORDCometChatConstants.GROUP_TYPE_PRIVATE
- Java
- Kotlin
createGroup() method takes the following parameters:
After the successful creation of the group, you will receive an instance of the
Group class which contains all the information about the particular group.
Add members while creating a group
You can create a group and add members at the same time using thecreateGroupWithMembers() method. This method takes the Group object, an array of GroupMember objects to be added, and an array of UIDs to be banned.
To create an object of the Group class, you can use either of the following constructors:
new Group(String GUID, String name, String groupType, String password)new Group(String GUID, String name, String groupType, String password, String icon, String description)
groupType needs to be one of the following values:
CometChat.GROUP_TYPE.PUBLICCometChat.GROUP_TYPE.PASSWORDCometChat.GROUP_TYPE.PRIVATE
GroupMember class, you can use the following constructor:
new GroupMember(String UID, String scope)
- Java
- Kotlin
onSuccess() block of this method provides you with 2 sets of information:
Group: The group object containing information about the group that was created.HashMap<String, String>: A HashMap that contains the UID of the user that was supposed to be added as the key andsuccessor an error message as the value.
Group Class
Group Payload Structure
Group Object
Group Object
The
Group object returned by SDK methods contains the following fields:Sample Group Object:
Next Steps
Join Group
Join existing groups to participate in conversations
Add Members
Add members to your created groups
Update Group
Modify group details and settings
Send Messages
Start sending messages in your group