Get channel details

Fetch details of a specific channel using the TryGetChannel() 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.TryGetChannel(
string channelId,
out Channel channel
)

Input

ParameterTypeRequiredDefaultDescription
channelIdstringYesn/aUnique channel identifier (up to 92 UTF-8 byte sequences).
channelout ChannelYesn/aThe channel to populate with the appropriate Channel object if the method returns true. If it returns false, the channel remains uninitialized.

Output

If the method returns true, the out channel parameter is populated with the appropriate Channel object. If it returns false, the channel remains uninitialized.

Basic usage

Fetch the support channel metadata.

if (chat.TryGetChannel("support", out var channel))
{
Console.WriteLine($"Found channel with name {channel.Name}");
};
Last updated on