please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
Unity(Game Solution)/
Group/
SDK
  • Run Demo
  • SDK Integration
  • Initialization
  • Login and Logout
  • Message
    • Message Overview
    • Sending Message
    • Receiving Message
    • Historical Message
    • Forwarding Message
    • Modifying Message
    • Deleting Message
    • Clearing Messages
    • Recalling Message
    • Online Message
    • Read Receipt
    • Querying Message
    • Group @ Message
    • Targeted Group Message
    • Notification Muting
    • Message Extension
  • Conversation
    • Conversation Overview
    • Conversation List
    • Getting Conversation
    • Conversation Unread Count
    • Pinning Conversation to the Top
    • Deleting Conversation
    • Conversation Draft
    • Conversation Mark
    • Conversation Group
  • Group
    • Group Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
    • Group Counter
  • User
    • User Profile
    • User Status
    • Friend Management
    • Friend List
    • Blocklist
  • Changelog
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Custom Group Attribute

Feature Description

The methods to manipulate group attributes are GroupGroupInitGroupAttributes, GroupGroupDeleteGroupAttributes, and GroupGroupGetGroupAttributes.
A new custom group field is designed based on the API 2.0. It is a "group attribute" that enables seat management in audio chat rooms. When a member mics on, a group attribute can be set to manage the member information. When the member mics off, the group attribute can be deleted. Other members can get the group attribute list to display the seat list.
Note:
Currently, the group attribute feature is available only for audio-video groups (AVChatRoom).
The group attribute has the following features:
1. You can create, read, update and delete (CRUD) group attributes directly in the client without console configuration.
2. Up to 16 group attributes are supported. Each group attribute can be up to 4 KB in size, and the total size of all the group attributes can be up to 16 KB.
3. The GroupInitGroupAttributes, setGroupAttributes, and GroupDeleteGroupAttributes APIs can be called by a logged-in user 10 times every 5 seconds in total in the SDK, after which the error code 8511 will be returned, or 5 times every second in total on the backend, after which the error code 10049 will be returned.
4. The GroupGetGroupAttributes API can be called by a logged-in user 20 times every 5 seconds in the SDK.

Initializing the group attributes

Call the GroupInitGroupAttributes API (Details) to initialize the group attributes, and the original group attributes, if any, will be cleared first.
Sample code:
// Initialize the group attributes
GroupAttributes attributes = new GroupAttributes
{
group_atrribute_key = "key",
group_atrribute_value = "value"
};
TIMResult res = TencentIMSDK.GroupInitGroupAttributes(group_id, attributes, (int code, string desc, string user_data)=>{
// Process the async logic
});

Deleting the group attributes

Call the GroupDeleteGroupAttributes API (Details) to delete a specified group attribute. If keys is null/nil, all the group attributes will be cleared.
Sample code:
// Delete the group attributes
GroupAttributes attributes = new List<string>
{
"attr1"
};
TIMResult res = TencentIMSDK.GroupDeleteGroupAttributes(group_id, attributes, (int code, string desc, string user_data)=>{
// Process the async logic
});

Getting the group attributes

Call the GroupGetGroupAttributes API (Details) to get a specified group attribute. If keys is null, all the group attributes will be obtained.
Sample code:
// Get the group attributes
GroupAttributes attributes = new List<string>
{
"attr1"
};
TIMResult res = TencentIMSDK.GroupGetGroupAttributes(group_id, attributes, (int code, string desc, List<GroupAttributes> attributes, string user_data)=>{
// Process the async logic
});

Updating the group attributes

If you have called SetGroupAttributeChangedCallback to add a group event listener, all the group attributes will be called back through GroupAttributeChangedCallback (Details) when a group attribute is changed.
Sample code:
TencentIMSDK.SetGroupAttributeChangedCallback((string group_id, List<GroupAttributes> group_attributes, string user_data)=>{
// Process the callback logic
});