Instant Messaging (IM) supports the following group types:
The following table describes the features and limitations of each group type:
Feature | Work Group (Work) | Public Group (Public) | Meeting Group (Meeting) | Community Group (Community) | Audio-Video Group (AVChatRoom) |
---|---|---|---|---|---|
Available member roles | Group owner and ordinary member | Group owner, group admin, and ordinary member | Group owner, group admin, and ordinary member | Group owner, group admin, and ordinary member | Group owner and ordinary member |
Requesting to join a group | Not supported | Supported with group owner or group admin approval required | Supported with no approval required | Supported with no approval required | Supported with no approval required |
Joining group via invitation by a member | Supported | Not supported | Not supported | Supported | Not supported |
Group owner quitting group | Supported | Not supported | Not supported | Not supported | Not supported |
Who can modify group profile | Any group member | Group owner and group admin | Group owner and group admin | Group owner and group admin | Group owner |
Who can kick group members out of group | Group owner | Group owner and group admin. Group admin can only remove ordinary group members. | Group members cannot be removed. The same effect can be achieved by muting members. | ||
Who can mute members | Muting members is not supported | Group owner and group admin. Group admin can only mute ordinary group members. | Group owner | ||
Unread count | Supported | Supported | Not supported | Supported | Not supported |
Viewing message history earlier than user's entry time | Not supported | Not supported | Supported | Supported | Not supported |
Retaining message history in the cloud |
|
Not supported | |||
Number of groups |
|
|
|
||
Number of group members |
|
100,000 | Unlimited number of group members |
Note:
- Group types are work group (Work), public group (Public), meeting group (Meeting), Community group (Community), and audio-video group (AVChatRoom). Private group (Private) and chat room (ChatRoom) in earlier versions (which have Public, Private, ChatRoom, and AVChatRoom groups) correspond to work group (Work) and meeting group (Meeting) in the new version respectively.
- In the Pro Edition or Flagship Edition SDKAppID, the maximum net increase in group count per day is 10,000 for all group types. Free peak group count is 100,000 per month, and you will need to pay for usage not covered by the free quota.
- The community group (Community) feature is supported only in SDK 5.8.1668 enhanced edition or higher. To use the feature, you need to purchase the Flagship Edition package and apply for activation.
- Work groups (Work) and public groups (Public) do not allows group members to view messages sent before they join the group. To enable the feature, submit a change request by referring to Configuration Change Ticket.
The simple API createGroup for group creation is disused after v3.6.0. Please use the advanced API for group creation in groupManager
instead.
If you want to initialize group information (for example, group introduction, group profile photo, and initial group members) when creating a group, call the createGroup API in the V2TIMGroupManager
management class. The V2TIMGroupManager
management class can be obtain via TencentImSDKPlugin.v2TIMManager.getGroupManager()
.
// Sample code: create a work group using the advanced createGroup API
List<V2TimGroupMember> list = [];
for (String userID in memberList) {
list.add(V2TimGroupMember(userID: userID, role: 200));
}
V2TimValueCallback<String> res =
await TencentImSDKPlugin.v2TIMManager.getGroupManager().createGroup(
groupType: "Work", // Work group
groupName: "groupName",
groupID: groupID,
notification: "notification", // Group notification
introduction: introduction, // Group introduction
isAllMuted: false, // Whether to mute all group members
faceUrl: "...",
addOpt: GroupAddOptTypeEnum.V2TIM_GROUP_ADD_ANY, // Permission to add a group
memberList: list, // Members added during group creation
);
groupType
is a string and can be one of Work
, Public
, Meeting
, Community
, and AVChatRoom
. To learn about the differences among group types, see Group Types.groupID
specifies the group ID, which uniquely identifies a group. Do not create groups with the same groupID
in a SDKAppID. If you set groupID
to null, you will be assigned a group ID by default.groupName
specifies the group description, which has a maximum length of 30 bytes.The processes for joining groups of different types are described as follows:
Type | Work Group (Work) | Public Group (Public) | Meeting Group (Meeting) | Community Group (Community) | Audio-Video Group (AVChatRoom) |
---|---|---|---|---|---|
How to join group | Users must be invited to join the group. | users join the group after requests are approved by group owner or admin. | Users can join and quit the group freely. | Users can join and quit the group freely. | Users can join and quit the group freely. |
Meeting groups (Meeting) and audio-video groups (AVChatRoom) can be used for interactive scenarios where users join and exit groups frequently, such as online conferencing and show live streaming. The group joining procedure is therefore the simplest.
After a user successfully joins a group by calling joinGroup, all group members (including the joined user) receive the onMemberEnter callback.
Resembling WeChat and WeCom groups, work groups (Work) are suitable for communication in work environments. The interaction pattern is designed to disable proactive group joining and only allows users to be invited to join the group by group members.
A group member calls inviteUserToGroup to invite a user to group, then all group members (including the inviter) receive the onMemberInvited callback.
Public groups (Public) are similar to the interest groups and tribes in QQ. Any user can request to join the group, but will not become a member of the group until the request is approved by the group owner or admin. While approval is required by default, the group owner or admin can call the setGroupInfo API to set the group joining option (GroupAddOptType
) to forbid anyone to join, which is tighter, or to disable the approval process, which is more flexible.
The following diagram illustrates the process of group joining that requires approval:
isAgreeJoin
is true
, the request is accepted. Otherwise, the request is rejected. If the request is accepted, all members (including the requester) receive the onMemberEnter callback.Call quitGroup to quit a group. The user who quits the group then receives the onQuitFromGroup callback and other group members receive the onMemberLeave callback.
Note:For a public group (Public), meeting group (Meeting), community group (Community), or audio-video group (AVChatRoom), the group owner is not allowed to quit the group but can delete the group.
Call dismissGroup to delete a group. Then all group members receive the onGroupDismissed callback.
Note:
- For a public group (Public), meeting group (Meeting), community group (Community), or audio-video group (AVChatRoom), the group owner can delete the group at any time.
- For a work group (Work), the group owner does not have the permission to delete the group. To delete the group, you must have your service server call the RESTful API.
Call getJoinedGroupList to get a list of work groups (Work), public groups (Public), meeting groups (Meeting), and community group (Community) the current user has joined. Audio-video groups (AVChatRoom) will not be included in this list.
Call getGroupsInfo to get the group profile of one or more groups at a time. To get the group profiles of multiple groups by a single call, pass in multiple groupID
at a time.
Call setGroupInfo to modify the group profile. When the modification is complete, all group members receive the onGroupInfoChanged callback.
Note:
- For work groups (Work), all group members can modify the basic group profile.
- For public groups (Public), meeting groups (Meeting), and community groups (Community), only the group owner and admin can modify the group profile.
- For audio-video groups (AVChatRoom), only the group owner can modify the group profile.
// Sample code: modify group profile
V2TimCallback res =
await TencentImSDKPlugin.v2TIMManager.getGroupManager().setGroupInfo(
info: V2TimGroupInfo.fromJson( // Pass in the V2TimGroupInfo type
{
"groupID": : "ID of the group for which you want to modify the group profile",
"groupName": "Name of the group for which you want to modify the group profile",
"groupType": "Work",
"notification": "notification",
"introduction": "introduction",
"faceUrl": faceUrl,
"isAllMuted": false,
"addOpt": GroupAddOptType.V2TIM_GROUP_ADD_ANY,
"customInfo": Map(),
},
),
);
Any group member can call the setGroupReceiveMessageOpt API to modify the group message receiving option. Available group message receiving options are as follows:
The group message receiving option allows you to mute group messages:
ReceiveMsgOptEnum.V2TIM_NOT_RECEIVE_MESSAGE
, no group message will be received, and the conversation list will not be updated.With the group message receiving option set toNote:This mode requires the unread count feature and therefore it applies only to work groups (Work) and public groups (Public).
ReceiveMsgOptEnum.V2TIM_RECEIVE_MESSAGE
, when new group messages are received and the conversation list needs to be updated, you can get the unread count through unreadCount. Use recvOpt to verify that a red dot instead of the unread count is displayed when the group message receiving option is ReceiveMsgOptEnum.V2TIM_RECEIVE_MESSAGE
.New custom group fields, also called group attributes, are designed. They have the following features:
initGroupAttributes
, setGroupAttributes
, and deleteGroupAttributes
APIs each can be called by the SDK for up to 10 times per 5 seconds, and the 8511 error code will be called back if the limit is exceeded. The APIs each can be called by the backend for up to 5 times per second, and the 10049 error code will be called back if the limit is exceeded.getGroupAttributes
API can be called by the SDK for up to 20 times per 5 seconds.With group attributes, you can manage the seats of audio chat rooms. When a user mics on, you can set a group attribute to manage the information of the user. When the user mics off, you can delete the group attribute. Other members can get the list of group attributes to display the seat list.
Call the initGroupAttributes API to initialize group attributes. If the group has existing group attributes, they will be deleted first.
Call the setGroupAttributes API to set group attributes. If the group attributes to set do not exist, they will be automatically added.
Call the deleteGroupAttributes API to delete specified group attributes. If you set the keys
field to null
, all group attributes will be deleted.
Call the getGroupAttributes API to get specified group attributes. If you set the keys
field to null
, all group attributes will be returned.
If any group attribute is updated, all group attribute fields will be called back via onGroupAttributeChanged.
Call getGroupMemberList to get the list of group members of a given group. The list contains profile information about individual members, such as user ID (userID
), group name card (nameCard
), profile photo (faceUrl
), nickname (nickName
), and time of joining group (joinTime
).
As a group might have a large number of members (for example, 5,000+), this API supports two advanced attributes: filter
and nextSeq
.
When calling the getGroupMemberList API, you can specify filter
to pull the information of certain roles.
Filter | Description |
---|---|
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ALL | Pull the information list of all group members |
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_OWNER | Pull the information list of the group owner |
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ADMIN | Pull the information list of the group admin |
GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_COMMON | Pull the information list of ordinary group members |
// Sample code: pull the profile of the group owner using the filter parameter
await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.getGroupMemberList(
groupID: "Your groupId",
filter: GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_OWNER,
nextSeq: "0",
);
In many cases, it makes more sense for the user interface to display the first page of the group member list instead of the complete list. More group members can be pulled when the user clicks Next Page or pull the list to refresh. For this scenario, you can apply the method of pulling paginated results.
The getGroupMemberList API returns a maximum of 50 members at a time. You can use the pagination flag nextSeq
to pull the paginated group member list. In the first attempt to pull the group member list, enter 0 for nextSeq
. When the first pull succeeds, getGroupMemberList
's callback result V2TIMGroupMemberInfoResult contains the nextSeq field.
V2TIMGroupMemberInfoResult
returned from the previous pull as parameter to the getGroupMemberList API.// Sample code: pull the paginated group member list using nextSeq
String nextSeq = "0";
getGroupMemberList(String nextSeq) async {
V2TimValueCallback<V2TimGroupMemberInfoResult> res =
await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.getGroupMemberList(
groupID: "Your groupId",
filter: GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ALL,
nextSeq: nextSeq,
);
setState(() {
resData = res.toJson();
if (res.data != null) {
nextSeq = res.data!.nextSeq!;
// ...
}
});
}
Call getGroupMembersInfo to get the profile of group members in batches. You can pass in multiple userID
at a time to improve network transmission efficiency.
The group owner or admin can call the setGroupMemberInfo API to modify the group-related information of members, including the group name card (nameCard
), group member role (role
), muting duration (muteUntil
), and custom fields.
The group owner or admin can mute a group member and set muting duration (in seconds) via muteGroupMember. Muting information is stored in the muteUtil attribute field of the group member. After the group member is muted, all group members (including the muted member) receive the onMemberInfoChanged event callback.
The group owner or admin can mute the entire group via the setGroupInfo API by setting the isAllMuted attribute field to true
. There is no time limit for group muting. The group can be unmuted through setAllMuted(false)
in the group profile.
The group owner or admin can call the kickGroupMember API to remove a group member. As an audio-video group (AVChatRoom) can have unlimited members, it does not support the API. You can use muteGroupMember to achieve the same effect instead.
After the member is removed, all group members (including the kicked member) receive the onMemberKicked callback.
The group owner can call setGroupMemberRole to change the role of a member of a public group (Public) or meeting group (Meeting). Roles available for changing are ordinary member and group admin.
The group owner can call transferGroupOwner to transfer the ownership of group to other group members.
After the group ownership is transferred, all group members receive the onGroupInfoChanged callback, where the type of V2TIMGroupChangeInfo
is GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_OWNER
and the value is the UserID of the new group owner.
Yes, but since an audio-video group (AVChatRoom) does not support storing message history in the cloud, it cannot pull the messages that were sent when it was disconnected.
Verify the group type:
Meeting groups (Meeting) and audio-video groups (AVChatRoom) are designed for conference and live streaming scenarios respectively, and they do not support the unread count feature.
Was this page helpful?