Get channel details

Fetch details of a specific channel using the getChannel() method.

Requires App Context

To store data about channels, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

This method takes the following parameters:

chat.getChannel(
channelId: String,
completion: ((Swift.Result<ChannelImpl?, Error>) -> Void)? = nil
)

Input

ParameterTypeRequiredDefaultDescription
channelIdStringYesn/aUnique channel identifier (up to 92 UTF-8 byte sequences).

Output

TypeDescription
ChannelImplObject returning the new channel metadata.

Basic usage

Fetch the support channel metadata.

/// Assuming you have a "chat" instance available
/// Invoke the "getChannel" method to fetch metadata of the 'support' channel
chat?.getChannel(
channelId: "support"
) {
switch $0 {
case let .success(channel):
if let channel = channel {
debugPrint("Fetched channel metadata with ID: \(channel.id)")
} else {
debugPrint("Channel not found")
}
case let .failure(error):
debugPrint("Failed to fetch channel metadata: \(error)")
}
show all 16 lines
Last updated on