Browse SDKs · iOS
SDKsiOSEnterprise

Retrieve the groups containing a conversation

Retrieve the complete groups containing a conversation with Open_im_sdkGetConversationGroupByConversationID.

Copy

One conversation can belong to multiple conversation groups. Use Open_im_sdkGetConversationGroupByConversationID to retrieve the groups that currently contain a specified conversation.

NSString *targetConversationID = conversationID;

CallbackProxy *callback = [[CallbackProxy alloc]
    initWithOnSuccess:^(NSString * _Nullable data) {
        [self mergeConversationGroupsJSON:data];
    }
    onFailure:^(NSInteger code, NSString * _Nullable message) {
        [self showConversationGroupError:code message:message ?: @"Failed to retrieve the conversation's groups"];
    }];

Pass callback and targetConversationID to Open_im_sdkGetConversationGroupByConversationID.

Result

The success callback's data is a JSON array of complete group objects, not an array of group-ID strings. This differs from the WASM SDK's getConversationGroupIDsByConversationID().

The query does not trigger the conversation-group listener. For incremental relationship updates, see Conversation groups overview.