Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Retrieve conversation groups

Retrieve conversation groups by type with Open_im_sdkGetConversationGroups.

Copy

Invoke Open_im_sdkGetConversationGroups to query the list of conversation groups belonging to the signed-in user by category:

Parameters

ParameterTypeRequiredDescription
groupTypeint64_tYesCategory of conversation groups to retrieve.

Group type enumeration

ValueNumeric valueDescription
00Regular custom groups manually created and managed by users.
11Rule-filtered groups maintained automatically.
22All group categories.

Code example

#import <OpenIMSDK/CallbackProxy.h>
@import OpenIMCore;

int64_t groupType = 2; // 0: regular, 1: filtered, 2: all

CallbackProxy *callback = [[CallbackProxy alloc]
    initWithOnSuccess:^(NSString * _Nullable data) {
        [self replaceConversationGroupsFromJSON:data];
    }
    onFailure:^(NSInteger code, NSString * _Nullable message) {
        NSLog(@"GetConversationGroups failed: %ld %@", (long)code, message);
    }];

Open_im_sdkGetConversationGroups(callback, groupType);

Return value

The onSuccess callback delivers a JSON array string in data containing the matching group objects. Parse the array and update the local in-memory group list keyed by conversationGroupID.

State changes after the call

  1. Snapshot query: This method provides an initial snapshot of group metadata without triggering asynchronous listener events.
  2. Event notification: Real-time modifications to groups across sessions or devices arrive via listener delegates. For listener registration and lifecycle details, refer to Conversation groups overview.