Delete channels
Remove a channel permanently with delete() or deleteChannel().
Both methods produce the same result. Call delete() on a Channel object or deleteChannel() on the Chat object with the channel ID.
Requires App Context
Enable App Context for your keyset in the Admin Portal.
Method signature
These methods take the following parameters:
-
delete()1channel.delete(): Promise<true> -
deleteChannel()1chat.deleteChannel(id: string): Promise<true>
Input
| Parameter | Required in delete() | Required in deleteChannel() | Description |
|---|---|---|---|
idType: stringDefault: n/a | No | Yes | Unique channel identifier. |
Output
| Type | Description |
|---|---|
Promise<true> | For delete(), a confirmation that the channel metadata was permanently deleted. |
Promise<true> | For deleteChannel(), a confirmation that the channel metadata was permanently deleted. |
Errors
Whenever the channel ID is required, and you try to delete a channel without providing its ID, you will receive the ID is required error.
Sample code
Permanently delete the support channel metadata.
-
delete()1// reference the "channel" object
2const channel = await chat.getChannel("support")
3// permanently delete the channel
4await channel.delete() -
deleteChannel()1// reference the "chat" object and invoke the "deleteChannel()" method
2const channel = await chat.deleteChannel("support")