In-app Chat
SDK Error Codes
On this page

Channel Management

2026-07-06

Feature Overview

A Channel is the basic carrier of chat interactions within a Community, functioning similarly to a traditional group. Each Community can contain multiple Channels. ZIM SDK provides comprehensive Channel management capabilities, supporting the following features:

  • Create/dismiss Channels
  • Update Channel name, avatar, and notice
  • Set/delete Channel custom attributes
  • Query Channel information and list
  • Set Channel mute status
  • Listen for Channel list changes and information updates

Prerequisites

  • Please refer to Implement basic message sending and receiving to complete ZIM SDK acquisition, initialization, and user login.
  • Please refer to Authenticate with Token to implement user authentication and login.
  • Community features require ZIM SDK 3.0.0 or later.
  • Community is a premium feature. Please contact ZEGOCLOUD Technical Support for activation before use.
  • The Token generation method for Community features is the same as for other ZIM features, with no additional permission declarations required.

Channel Type Description

TypeDescriptionJoin MethodVisibility
GENERALDefault Channel, automatically created when a Community is created. Community-level Tips and notifications are sent in this ChannelAuto-joinVisible to all members
PUBLICPublic Channel, needs to be created after the Community is createdAuto-joinVisible to all members
Note

GENERAL and PUBLIC have identical functionality. The only difference is the creation timing: GENERAL is automatically created when the Community is created, while PUBLIC must be manually created after the Community is established.

Create a Channel

After joining a Community, call the createCommunityChannelWithChannelInfo API, passing in the Channel basic information ZIMCommunityChannelInfo and creation configuration ZIMCommunityChannelCreateConfig to create a Channel in the specified Community.

Note
  • Only the Community owner and admins have permission to create Channels.
  • When a Community is created, the system automatically creates a default Channel of type GENERAL. Developers can create additional public Channels (PUBLIC) on top of this.
  • channelID supports custom definition. Only numbers, English characters, and the following special characters are supported: ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~, but it cannot start with #. If left blank, the ZIM server will create a Channel with a channelID starting with #C.
  • After successful creation, you are automatically joined to the Channel without needing to call the join API.
ZIMCommunityChannelInfo *channelInfo = [[ZIMCommunityChannelInfo alloc] init];
channelInfo.channelID = @"channel_001";
channelInfo.channelName = @"Announcements"; // Max length 300 characters, configurable
channelInfo.channelAvatarUrl = @"https://example.com/channel_avatar.png"; // Max length 100 characters, configurable
channelInfo.communityID = communityID;

ZIMCommunityChannelCreateConfig *config = [[ZIMCommunityChannelCreateConfig alloc] init];
config.channelNotice = @"This is the Channel notice"; // Max length 500 characters, configurable
config.channelAttributes = @{@"type": @"announcement"};

[zim createCommunityChannel:channelInfo config:config callback:^(ZIMCommunityChannelFullInfo * _Nonnull channelFullInfo, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Created successfully
    }
}];

Dismiss a Channel

Call the dismissCommunityChannelByChannelID API to dismiss a Channel in the specified Community. After dismissal, all members will no longer be able to access the Channel.

Warning
  • The default Channel of type GENERAL cannot be dismissed.
[zim dismissCommunityChannel:channelID communityID:communityID callback:^(NSString * _Nonnull communityID, NSString * _Nonnull channelID, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Dismissed successfully
    }
}];

Update Channel Profile

Community owners and admins can update the Channel's name, avatar, and notice.

Update Channel Name

Call the updateCommunityChannelName API to update the Channel name. The maximum Channel name length is 300 characters, configurable.

[zim updateCommunityChannelName:@"New Channel Name" channelID:channelID communityID:communityID callback:^(NSString * _Nonnull communityID, NSString * _Nonnull channelID, NSString * _Nonnull channelName, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Updated successfully
    }
}];

Update Channel Avatar

Call the updateCommunityChannelAvatarUrl API to update the Channel avatar. The maximum Channel avatar length is 100 characters, configurable.

[zim updateCommunityChannelAvatarUrl:@"https://example.com/new_channel_avatar.png" channelID:channelID communityID:communityID callback:^(NSString * _Nonnull communityID, NSString * _Nonnull channelID, NSString * _Nonnull channelAvatarUrl, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Updated successfully
    }
}];

Update Channel Notice

Call the updateCommunityChannelNotice API to update the Channel notice content. The maximum Channel notice length is 500 characters, configurable.

[zim updateCommunityChannelNotice:@"New Channel Notice" channelID:channelID communityID:communityID callback:^(NSString * _Nonnull communityID, NSString * _Nonnull channelID, NSString * _Nonnull channelNotice, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Updated successfully
    }
}];

Set Channel Attributes

Channel attributes are stored as key-value pairs and can be used to extend custom information about the Channel.

Set Attributes

Call the setCommunityChannelAttributes API to batch-set Channel custom attributes. Failed key names will be returned through errorKeys.

NSDictionary<NSString *, NSString *> *channelAttributes = @{@"key1": @"value1", @"key2": @"value2"};

[zim setCommunityChannelAttributes:channelAttributes channelID:channelID communityID:communityID callback:^(NSString * _Nonnull communityID, NSString * _Nonnull channelID, NSArray<NSString *> * _Nonnull errorKeys, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Set successfully
    }
}];

Delete Attributes

Call the deleteCommunityChannelAttributesByKeys API to batch-delete Channel attributes by key names.

NSArray<NSString *> *keys = @[@"key1", @"key2"];

[zim deleteCommunityChannelAttributes:keys channelID:channelID communityID:communityID callback:^(NSString * _Nonnull communityID, NSString * _Nonnull channelID, NSArray<NSString *> * _Nonnull errorKeys, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Deleted successfully
    }
}];

Query Channel Information

Call the queryCommunityChannelsInfoByChannelIDs API to batch query the complete information of specified Channels, including name, avatar, notice, mute status, etc. Failed Channel IDs will be returned through errorChannelIDs.

NSArray<NSString *> *channelIDs = @[@"channel_001", @"channel_002"];

[zim queryCommunityChannelsInfoByChannelIDs:channelIDs communityID:communityID callback:^(NSString * _Nonnull communityID, NSArray<ZIMCommunityChannelFullInfo *> * _Nonnull channelInfos, NSArray<NSString *> * _Nonnull errorChannelIDs, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Queried successfully
    }
}];

Query Channel List

Call the queryCommunityChannelListByCommunityID API to retrieve all Channel lists in the specified Community in pages. The conversationID field in the returned ZIMCommunityChannel object is the conversation ID needed for subsequent message sending and receiving.

Pagination rules are the same as querying the Community list: for the first query, set config.nextFlag to 0, then pass the returned nextFlag to the next request until it returns 0. The count range is 1-100, with a recommended value of 20.

ZIMCommunityChannelListQueryConfig *config = [[ZIMCommunityChannelListQueryConfig alloc] init];
config.nextFlag = 0;

[zim queryCommunityChannelList:communityID count:100 config:config callback:^(NSString * _Nonnull communityID, NSArray<ZIMCommunityChannel *> * _Nonnull channelList, long long nextFlag, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Queried successfully; channelList is the Channel list
    }
}];

Mute Channels

Call the muteCommunityChannels API to batch set the mute status of specified Channels. Mute configuration is passed through ZIMCommunityChannelMuteConfig.

channelIDs and communityID are direct parameters of the API method, not config configuration fields.

Configuration FieldDescription
modeMute scope. Enum values: NONE(0) = no mute, NORMAL(1) = mute regular members, ALL(2) = mute all members, CUSTOM(3) = custom role scope
durationMute duration (seconds), range 1-2592001 (approximately 30 days), or -1 for permanent mute
rolesWhen mode is CUSTOM, specifies the list of roles to be muted

Failed Channel IDs will be returned through errorChannelIDs. For detailed operations, please refer to Community Mute.

NSArray<NSString *> *channelIDs = @[@"channel_001", @"channel_002"];

ZIMCommunityChannelMuteConfig *config = [[ZIMCommunityChannelMuteConfig alloc] init];
config.duration = 3600;
config.mode = ZIMCommunityChannelMuteModeAll;

[zim muteCommunityChannels:YES channelIDs:channelIDs communityID:communityID config:config callback:^(NSString * _Nonnull communityID, BOOL isMute, NSArray<NSString *> * _Nonnull errorChannelIDs, ZIMError * _Nonnull errorInfo) {
    if (errorInfo.code == ZIMErrorCodenoneSuccess) {
        // Mute set successfully
    }
}];

Listen for Channel Changes

Channel List Changes

When a Channel is created or dismissed in a Community, causing the Channel list to change, the SDK will trigger the communityChannelListChangedWithResult callback. changeInfoList contains the change type and Channel information for each changed Channel.

- (void)zim:(ZIM *)zim communityChannelListChangedWithResult:(ZIMCommunityChannelListChangedEventResult *)result {
    NSString *communityID = result.communityID;
    for (ZIMCommunityChannelChangeInfo *changeInfo in result.changeInfoList) {
        // changeInfo.action: change type
        // changeInfo.channel: changed Channel information
    }
}

Channel Information Updates

When Channel profile (name, avatar, notice, attributes, mute status, etc.) changes, the SDK will trigger the communityChannelInfoUpdatedWithResult callback. updateInfoList contains the updated complete Channel information.

- (void)zim:(ZIM *)zim communityChannelInfoUpdatedWithResult:(ZIMCommunityChannelInfoUpdatedEventResult *)result {
    NSString *communityID = result.communityID;
    for (ZIMCommunityChannelFullInfoUpdateInfo *updateInfo in result.updateInfoList) {
        // updateInfo.channelInfo: updated complete Channel information
    }
}
2026-06-24

Previous

Community member management

Next

Channel message management