Group System
Group System Overview
The group system is an instant messaging system that allows multiple participants to communicate in one chat. The group system has the following basic capabilities:
Comprehensive group management capabilities: Group creation and disbanding, member management, group profile management, member profile management, and more.
Stable and reliable messaging and a sophisticated group message management mechanism: Permission control, muting/unmuting, message callback, message roaming, and more.
Based on common use cases, Chat provides the following default group types: Work , Public , Meeting , AVChatRoom , and Community .
Upper limit on the number of group members:
The number of members in a Work, Public, or Meeting group can be increased to a maximum of 6,000 if fees are paid. For more information, see Pricing.
A Community group supports up to 100,000 members per group.
There is no upper limit on the number of members in an AVChatRoom.
Note:
Although AVChatRoom supports unlimited group members, if a spike in group members is expected within a short time (in scenarios such as large online events where the number of members in a single group reaches 50,000 or above), contact the channel manager in advance and report service resource usage by providing the SDKAppID and the scheduled event time.
Currently, historical message storage is available only for non-AVChatRoom groups, with messages stored for 7 days for billing plans of the Developer edition and Standard edition and 30 days for the Premium edition by default. If you require a longer storage period, change the storage period of historical messages in the console. Increasing the storage period of historical messages is a value-added service. For more information on pricing, see Pricing.
Community is a new powerful tool for entertainment collaboration. Within the same community, a high number of members can be divided into different groups and topics to separate messages for hierarchical communication, yet they can also share the same set of friend relationships. This helps you develop a unique path of social expansion. The community feature is widely suitable for diverse use cases, such as finding like-minded people, game-based social networking, fan marketing, and organization management.
The Community feature is supported by the SDK of the Enhanced edition on v5.8.1668 or later and the SDK for web on v2.17.0 or later. You need to purchase the Premium edition, go to the console, select Group feature configuration, and enable Community.
Chat's group system is highly customizable, allowing you to use:
Group Member Roles
The following table lists various group member roles and their permissions:
Group Member Role | Description | Management Permission |
Ordinary member | An ordinary member has no management permissions. | In a Work group, an ordinary member has the permission to modify the group profile. |
Admin | An admin is appointed by the group owner to assist in managing group members and holds certain management permissions. | Modify the group profile. Remove an ordinary member from the group. Mute an ordinary member, that is, prevent the ordinary member from speaking for a certain period of time. Approve or reject a membership application. Work groups do not support the setting of admins by default. |
Group owner | A group owner is the creator of a group and has the highest level of management permissions in the group. | The group owner has the following permissions in addition to all permissions held by an admin: Appoint or cancel an admin. Remove an admin from the group. Mute an admin. Disband the group. Transfer the group. |
App admin | This special role has the authority to manage all group permissions in the app and has more power than the group owner. | The app admin has the same permissions as the group owner, whether it is a member of the group or not. |
Group Types
Based on common use cases, Chat provides the following default group types:
Group type | Applicable scenario |
Work | After a Work group is created, users can join the group only after being invited by group members. The invitation does not need to be accepted by the invitee or approved by the group owner. This group type is the same as private group (Private) in earlier versions. |
Public | After a Public group is created, the group owner can designate group admins. To join the group, a user needs to search for the group ID and send a request, and the request needs to be approved by the group owner or an admin before the user can join the group. |
Meeting | A Meeting group allows users to join and leave freely and view historical messages sent before they join the group. Meeting groups are ideal for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio/video conferencing and online education. This group type is the same as chat room (ChatRoom) in earlier versions. |
AVChatRoom | An AVChatRoom group allows users to join and exit freely, supports an unlimited number of members, and does not store message history. Audio-video groups can be used with Cloud Streaming Services (CSS) to support on-screen comment chat scenarios. |
Community | A Community group allows users to join and exit freely, supports up to 100,000 members, and stores message history. To join the group, a user needs to search for the group ID and send an application, and the application does not need to be approved by an admin before the user can join the group. |
Differences in Basic Group Capabilities
Item | Work | Public | Meeting | AVChatRoom | Community |
Available member roles | Group owner Ordinary member Application admin | Group owner Admin Ordinary member App admin | Group owner Admin Ordinary member App admin | Group owner App admin | Group owner Admin Ordinary member App admin |
Permission to modify basic group information | Ordinary member Group owner Application admin | Group admin Group owner App admin | Group owner App admin | Group owner App admin | Admin Group owner App admin |
Number of group members whose information can be obtained | All group members | All group members | All group members | None (no group member information stored) | All group members |
Who can disband a group | App admin | Group owner and app admin | Group owner and app admin | Group owner and app admin | Group owner and app admin |
Note:
Group types are upgraded in the new SDK version and they are Work , Public , Meeting , AVChatRoom , and Community . Private and ChatRoom in earlier versions (which have Public, Private, ChatRoom, and AVChatRoom groups) correspond to Work and Meeting in the new version respectively.
Ordinary members of Work can modify only the group name, introduction, announcement, and group profile photo URL, but not other group profile information.
If the roles of a group type cannot meet your business needs, you can add roles by setting member-level custom fields.
It is necessary to obtain the information about some members in scenarios where an audio-video group displays a list of some of its members.
Differences in Joining a Group
Item | Work | Public | Meeting | AVChatRoom | Community |
Perform an exact search for a group ID to join a group | Not supported | Supported | Supported | Supported | Supported |
Perform a fuzzy search for group information to join a group | Not supported | Not supported | Not supported | Not supported | Not supported |
Apply to join a group | Not supported | Supported. Approval from the group owner or admin is needed. | Supported. No approval is needed. | Supported. No approval is needed. | Supported. No approval is needed. |
Join a group after an invitation from a group member is received | Supported | Not supported | Not supported | Not supported | Supported |
Note:
Exact search is to search for a group by group ID. Fuzzy search is to search for a group by fields such as the group name.
Approval for joining a group: the group owner and admin can choose to approve or reject applications made by non-members to join the group. Only approved users can join the group.
For a group type that does not support the invitation of non-members to a group, group members can share the group ID with non-members in the app so that the non-members can join the group.
Differences in Member Management Capabilities
Item | Work | Public | Meeting | AVChatRoom | Community |
Setting admins | Not supported | Supported | Supported | Supported | Supported |
A group owner quits the group | Supported. After the group owner quits, the group has no group owner. | Not supported | Not supported | Not supported | Not supported |
Remove a group member | Supported. The group owner can remove group members. | Supported. The group owner and admin can remove group members, but the admin can remove only ordinary group members. | Supported. The group owner and admin can remove group members, but the admin can remove only ordinary group members. | Not supported. The muting feature can be used to achieve a similar effect. | Supported. The group owner and admin can remove group members, but the admin can remove only ordinary group members. |
Mute a group member | Not supported | Supported. The group owner and admin can mute group members, but the admin can mute only ordinary group members. | Supported. The group owner and admin can mute group members, but the admin can mute only ordinary group members. | Supported. The group owner can mute group members. | Supported. The group owner and admin can mute group members, but the admin can mute only ordinary group members. |
Periodically remove offline group members | Supported, but disabled by default. | Supported, but disabled by default. | Supported, but disabled by default. | Not supported | Not supported |
Note:
Muted group members cannot send group chat messages within the mute period.
Differences in Group Limits
Item | Work/Public/Meeting | AVChatRoom | Community |
Maximum number of members | Developer edition: 20 per group Standard edition: 200 members/group by default, which can be extended to 2,000 members/group through a value-added service. Premium edition: 2,000 members/group by default, which can be extended to 6,000 members/group through a value-added service. | Unlimited | Developer edition: not supported Standard edition: not supported Premium edition: 100,000 members/group by default |
Maximum number of groups | Developer edition: up to 100 existing groups, and disbanded groups do not count against the quota. Standard edition or Premium edition: unlimited | Developer edition: up to 10 existing groups, and disbanded groups do not count against the quota Standard edition: up to 50 existing groups, and disbanded groups do not count against the quota. You can upgrade to an unlimited number of audio-video groups by purchasing the value-added service. Premium edition: unlimited | Developer edition: not supported Standard edition: not supported Premium edition: 100,000 groups can be created by default. |
Caution
Under the Standard or Premium Edition SDKAppID, the daily net increase in group count (excluding communities) is capped at 10,000 (i.e., created group count minus dissolved group count).
In the Standard edition or Premium edition SDKAppID, the free peak group count is 100,000 per month, and you will need to pay fees for exceeding the quota in a plan. It is recommend that you disband the groups that are no longer needed in a timely manner.
Differences in Message Capabilities
Item | Work | Public | Meeting | AVChatRoom | Community |
Unread message count | Supported | Supported | Not supported | Not supported | Supported |
Historical message storage | Supported | Supported | Supported | Not supported | Supported |
Viewing roaming messages from before a user joins the group | Not supported | ||||
Notification of group member change | A notification is pushed and stored on the roaming server by default when a user is invited to a group, asks other users to join a group, is kicked out of a group, or leaves a group. This feature can be configured in the console. | A notification is pushed and stored on the roaming server by default when a user is invited to a group, asks other users to join a group, is kicked out of a group, or leaves a group. This feature can be configured in the console. | A notification is disabled by default when a user is invited to a group, asks other users to join a group, is kicked out of a group, or leaves a group. This feature can be configured in the console. | A notification is pushed but not stored on the roaming server when a user is invited to a group, asks other users to join a group, is kicked out of a group, or leaves a group. | A notification is pushed and stored on the roaming server by default when a user is invited to a group, asks other users to join a group, is kicked out of a group, or leaves a group. This feature can be configured in the console. |
Notification of group profile change | A notification is pushed and stored on the roaming server by default when the group name, group notifications, group introduction, group profile photo, or group owner is changed, and a notification is disabled by default when group muting or the group joining mode is changed. Both can be configured in the console. | A notification is pushed and stored on the roaming server by default when the group name, group notifications, group introduction, group profile photo, or group owner is changed, and a notification is disabled by default when group muting or the group joining mode is changed. Both can be configured in the console. | A notification is pushed and stored on the roaming server by default when the group name, group notifications, group introduction, group profile photo, or group owner is changed, and a notification is disabled by default when group muting or the group joining mode is changed. Both can be configured in the console. | A notification is pushed but not stored on the roaming server when the group name, group notifications, group introduction, group profile photo, or group owner is changed, and a notification is disabled when group muting or the group joining mode is changed. | A notification is pushed and stored on the roaming server by default when the group name, group notifications, group introduction, group profile photo, or group owner is changed, and a notification is disabled by default when group muting or the group joining mode is changed. Both can be configured in the console. The community joining mode cannot be changed, so no notification will be pushed. |
Notification of group member profile change | A notification is pushed and stored on the roaming server by default when the group muting or group admin is changed. This feature can be configured in the console. | A notification is pushed and stored on the roaming server by default when the group muting or group admin is changed. This feature can be configured in the console. | A notification is disabled by default when the group muting or group admin is changed. This feature can be configured in the console. | A notification is disabled by default when the group muting or group admin is changed. This feature can be configured in the console. | A notification is pushed and stored on the roaming server by default when the group muting or group admin is changed. This feature can be configured in the console. |
A message must be sent to activate a new group | Required | Not required | Not required | Not required | Not required |
Default message receiving option | Receive online and offline push messages | Receive online and offline push messages | Receive only online push messages | Receive only online push messages | Receive online and offline push messages |
Note:
For a group that requires activation, before the group owner sends a message, the group is inactive and invisible to all group members except the group owner. A group that does not require activation is visible to all group members once it is created.
Currently, offline push is available only on Android (Android offline push) and iOS (APNs push) platforms.
The work group, public group, meeting group, and community group have the historical message storage capability, which allows historical messages to be stored for 7 days (30 days for the Premium edition) free of charge by default. If you need a longer storage period, change the storage period of historical messages in the console. Increasing the storage period of historical messages is a value-added service. For more information on pricing, see Pricing.
Differences in Batch Import and Automatic Repossession
Item | Work/Public/Meeting/Community | AVChatRoom |
Importing groups, group members, and group messages is allowed | Yes. It is allowed when historical groups are migrated from a third-party platform to Chat. | No. Only existing groups, group members, and group messages can be used. |
Time before a group is automatically repossessed (in seconds). | The backend does not repossess groups, unless the group owner disbands the group or all members quit the group. (About group disbanding: the backend does not proactively disband a group unless the group owner disbands the group or the group is automatically repossessed. If automatic repossession is configured for a group, the backend irregularly traverses the group and disbands it if no one sends a message in the group for n seconds or the group profile is modified.) | The backend does not repossess groups, unless the group owner disbands the group or all members quit the group. |
Group Data Structure
Group Basic Information
Field Name | Type | Description | Notes |
GroupId | String | Unique identifier of the group | Read-only. Each group ID must be unique in the app. The prefix is @TGS#, and custom group IDs can also be used in the app. |
Type | String | Group type | Read-only. The following group types are supported by default: work group, public group, meeting group, audio-video group, and community group. For more information, see Group Types. In the SDK of an earlier version, group types also include the private group, ChatRoom, and BChatRoom, which are not recommended. |
Name | String | Name of the group | Readable and writable. The maximum length is 30 bytes and cannot be adjusted. |
Introduction | String | Introduction of the group | Readable and writable. The maximum length is 240 bytes and cannot be adjusted. |
Notification | String | Group announcement | Readable and writable. The maximum length is 300 bytes and cannot be adjusted. |
FaceUrl | String | URL of the group's profile photo | Readable and writable. The maximum length is 100 bytes and cannot be adjusted. |
Owner_Account | String | ID of the group owner | Read-only. |
CreateTime | Integer | Creation time of the group | Read-only. |
InfoSeq | Integer | This value increases every time the group information changes. | Read-only. |
LastInfoTime | Integer | Time of the last change to group information | Read-only. |
LastMsgTime | Integer | Time of the last message in the group chat | Read-only. |
NextMsgSeq | Integer | Seq of the next message in the group chat | Read-only. Every message in the group chat has a unique Seq , and the Seq values are consecutive numbers based on the sequence of sent messages. With every message sent to the group chat, NextMsgSeq (starting from 1) increases by 1 (by default, system messages such as notifications of group join or leaving are messages and can cause NextMsgSeq to increase by 1). |
MemberNum | Integer | Number of current members | Read-only. |
MaxMemberNum | Integer | Maximum number of members | Default value: The upper limit of the paid plan; for example, it is 20 on Developer edition. If you upgrade the plan, you need to modify this field to the corresponding value according to the basic information of the modified group. |
ApplyJoinOption | String | Membership application option | The following options are available: DisableApply: disallow any application. NeedPermission: group owner or admin's approval is required. FreeAccess: users can join the group freely without prior approval. |
Note:
The permissions to modify the group name, introduction, announcement, and profile photo URL are described as follows:
In a work group, any member can modify them.
For other group types, only non-ordinary members can modify them.
Group Member Profile
Field Name | Type | Description | Notes |
Member_Account | String | Group member ID | Read-only. |
Role | String | Role in the group | A group has the following roles: Owner (group owner), Admin (group admin), and Member (group member). |
JoinTime | Integer | Time of joining the group | Read-only. |
MsgSeq | Integer | Sequence number of the current read message of the member | Read-only. |
MsgFlag | String | Message receiving option | The following options are available: AcceptAndNotify: Accept and notify. AcceptNotNotify means accept without notifying (does not trigger Offline Push) Discard: block group messages (messages are not pushed to clients) AcceptNotNotifyExceptAt means accept and notify for 'at' messages (Only 'at' messages trigger Offline Push, other messages do not trigger) |
LastSendMsgTime | Integer | Time of sending the last message | It supports three ordinary groups, but does not support AVChatRoom. It can only be used by server-side APIs. |
NameCard | String | Group name card | Readable and writable. It can contain up to 50 bytes and cannot be adjusted. |
MuteUntil | Integer | Muting status | If it is 0 , the group member is not muted; otherwise, it indicates the muting stop timestamp. |
Permission Group Information
Field Name | Type | Description | Notes |
PermissionGroupId | String | Unique identifier of the permission group | Read-only |
PermissionGroupName | String | Name of the permission group | Readable and writable. It can contain up to 150 bytes and cannot be adjusted. |
Permission | Integer | Permissions of the permission group | Readable and writable. It is a 64-bit integer, and each bit represents a management permission. |
CustomString | String | Custom field of the permission group | Readable and writable. It contains up to 3,000 bytes. The business layer can use this field for implementing requirements in special scenarios. |
MemberNum | Integer | Number of members in the permission group | Read-only |
CreateTime | Integer | Creation time of the permission group | Read-only |
Permissions in the Permission Group
Management of permissions within a group is primarily accomplished through the permissions detailed in the permission group information and those related to topics. Each bit represents a permission. When a permission bit is set to 1, this management permission is granted.
Meanings of Permissions in the Permission Group
Permission Name | Description | Permission Bits and Their Values |
ManageGroupInfo | ++Permission for modifying the group information+ | 1<<0 (left shift to 0 bit, the same below) |
ManageGroupMember | Permission for adding/deleting members to/from a group or modifying the information of a member group | 1<<1 |
ManagePermissionGroupInfo | 1. Permission for creating, modifying, and deleting permission groups 2. Permission for setting permission groups (Add, Modify, and Delete) in all topics | 1<<2 |
ManagePermissionGroupMember | Permission for adding/deleting members to/from a permission group | 1<<3 |
ManageTopic | Permission for creating, modifying, and deleting topics | 1<<4 |
GroupMuteMember | Permission for muting group members | 1<<5 |
SendGroupMessage | Permission for sending messages in the community | 1<<6 |
GroupAtAll | Permission for using @all when sending messages in the community | 1<<7 |
GetGroupHistoryMessage |
Pull Permission for getting history messages before the member joins the group | 1<<8 |
RevokeOtherMemberGroupMessage | Permission for revoking group messages of others | 1<<9 |
BanMemberGroupMessage | Permission for banning group members | 1<<10 |
Topic Permissions
Permission Name | Description | Permission Bits and Their Values |
ManageTopicInfo | Permission for modifying and deleting topics | 1<<0 (left shift to 0 bit, the same below) |
ManagePermissionTopicInfo | Permission for setting permission groups (Add, Modify, and Delete) in this topic | 1<<1 |
TopicMuteMember | Permission for muting members in topics | 1<<2 |
SendTopicMessage | Permission for sending messages in topics | 1<<3 |
GetTopicHistoryMessage | Permission for getting history messages before the member joins the topic | 1<<4 |
RevokeOtherMemberTopicMessage | Permission for revoking topic messages of others | 1<<5 |
TopicAtAll | Permission for using @all when sending messages in topics | 1<<6 |
Custom Group IDs
When a group is created in the app, Chat assigns a default group ID to the new group by default. This default group ID starts with @TGS# and is unique in the app.
Chat also allows you to customize group IDs that are simple and easy to remember and communicate. A custom group ID must be a string of ASCII characters (0x20-0x7e) with a length less than 48 bytes. Do not use @TGS# as the prefix to avoid confusion with assigned group IDs.
Note:
The prefix of the IDs of community groups (Community) must be @TGS#_.
Custom Topic IDs
When a topic is created in the app, Chat assigns a default topic ID to the new topic by default. The ID starts with
GroupId+@TOPIC#_
and is unique in the group.To make it easier to remember and communicate the topic ID, Chat allows customizing it in the format of
GroupId+@TOPIC#_+ custom part
during topic creation through the RESTful API in the application. The custom part cannot contain @TGS#_
and @TOPIC#_@TOPIC#
(to avoid confusion with the default group ID) and must consist of printable ASCII characters (`0x20-0x7e).For example, if
GroupId
is @TGS#_@TGS#cQVLVHIM62CJ
, and the custom part is TestTopic
, the custom topic ID will be @TGS#_@TGS#cQVLVHIM62CJ@TOPIC#_TestTopic
. The entire custom topic ID must be no longer than 96 bytes.Customizing Permission Group IDs
By default, when an app creates a permission group, Chat assigns a default permission group ID to the newly created group. This ID will start with @PMG#_@PMG# and is unique within the group.
To make the permission group ID simpler and easier to remember and disseminate, Chat supports app in customizing the permission group ID through the RESTful API when creating a permission group. The custom permission group ID must start with @PMG#_ (but not with @PMG#_@PMG# to avoid confusion with the default assigned permission group ID) and be printable ASCII characters (
0x20-0x7e
).Custom Fields
Chat allows you to configure up to 10 group-level custom fields and 5 member-level custom fields based on your business needs. With custom fields, apps can attach additional data to groups, and the data can be read and written through existing APIs.
Description
Custom fields have the following characteristics:
Their values are expressed in key-value format.
Key is a string with a length less than 16 bytes. Its name contains only uppercase and lowercase letters, numbers, and underscores (_).
Value is a buffer customized by the user, which can be binary data. Group-level values have a maximum length of 512 bytes, while member-level values have a maximum length of 64 bytes.
You can configure the least read permission and the least write permission for each key.
The read and write permissions of a custom field are listed as follows, from high to low:
1. Readable and writable by the app admin.
2. Readable and writable by the group owner.
3. Readable and writable by the group admin.
4. Readable and writable by group members.
5. Readable and writable by anyone, including non-members.
For example, an app needs to extend the
GroupLevel
field for groups and the value of this field is a number representing the level of a group. If this level information is calculated by the app backend, then the least write permission should be writable by the app admin. If the field is part of the public profile of the group, its least read permission should be readable by anyone, including non-members.If the value to be stored is a number, we recommend that C and C++ developers store it as a string instead of binary data. For example, when the number to be stored is 1, store it as string
1
instead of binary data 0x01
. In the future, Chat will offer more operations for custom fields, such as specific mathematical operations on values, which will be performed on the basis of string-type numbers.Configuration
Custom fields at these two levels can be configured in the Chat console.
To configure member-level custom fields, you need to specify the group type first. Audio-video group and custom group types that are configured based on it do not support custom fields at the group member level, because these types of groups do not store member profiles.
The self read and write permissions indicate whether members can read and write their own member-level custom fields. For example, a member-level customer field named
MemberLevel
represents the level of a member in a group. Group members can read but not modify their own levels, and therefore their self read and write permissions are set to readable/unwritable for this field.Note:
Configured custom fields cannot be deleted or modified. Proceed with caution.
Custom Callbacks
Third-party callback is an important means to meet the special requirements of apps. It provides users with the capability to customize actions.
Chat's group system supports different callbacks. For more information, see Third-Party Callback Overview and Callback Command List.