Browse SDKs · Android
SDKsAndroid

Delete all messages from a user in a group chat

Delete every message sent by a specified user in a group chat with the Android SDK.

Copy
messageManager.deleteUserAllMessagesInConv(
    conversationID,
    targetUserID,
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // The deletion request has completed
        }

        @Override
        public void onError(int code, String error) {
            // Handle the failure
        }
    }
);

This API is available only for group chats and deletes every message sent by the specified user in the target group conversation. If the caller does not have permission, onError returns the error.

Other clients receive the deletion notification through OnAdvanceMsgListener.onDeleteUserAllMsgsInConv. The callback includes the corresponding conversationID and userID:

@Override
public void onDeleteUserAllMsgsInConv(DeleteUserAllMsgsListenerMsg event) {
    // event identifies the affected conversation and user.
}