Delete group channel, occur this issue

after i make a group channel, i try to delete group channel. but i cannot delete this, and print error

SendBirdException: Not authorized. “To delete the channel, the user should be an operator.”.
at A.value (http://localhost:8080/resources/js/static/lib/SendBird.min.js:6:20306)
at http://localhost:8080/resources/js/static/lib/SendBird.min.js:6:19719

But I use same id by making and removing a group channel. then how can i resolve it ?
i use delete API this

function deleteGroupChannelCustom(channelUrl){
sb.GroupChannel.getChannel(channelUrl, function (channel, error) {
if (error) {
return;
}

channel.delete(function(response, error) {
    if (error) {
        // Handle error
	console.log(error);
	alert('@err occur');  <<<<< occur error
    }
	
	
});

});
}

Hi @11110 ,

Even though the user created it via the SDK, unless you specifically set them as an Operator on creation, they are not considered one, and thus can’t delete the channel. You would want to ensure you set them as an operator when you create the channel adding the operatorUserIds key to your GroupChannelParams

For example, you may do this:

const params = new sb.GroupChannelParams();
params.addUserIds(['John', 'Harry']);
params.operatorUserIds = ['Jay']; 

sb.GroupChannel.createChannel(params, function(groupChannel, error) {
    if (error) {
        // Handle error.
    }
    const channeUrl = groupChannel.channelUrl;
});
1 Like

thx :slight_smile: then i have a some question !
If i make a groupchannel by using operatorUserIds (example, default value )
how can use this operatorUserIds params during removing group channel?

ooooohh i solve this problem !!!
i dont use array only value but using array solve problem thx :slight_smile:

Glad to hear you were able to resolve it! Please don’t hestiate to let us know if you have any more questions.