/ SDKs / Unity
SDKs
Chat SDKs Unity v4
Chat SDKs Unity
Chat SDKs
Unity
Version 4

Search open channels by name, URL, or custom type

Copy link

You can search for specific open channels by adding keywords to an SbOpenChannelListQuery instance. There are two types of keywords that can be used: name and URL.

The code sample below shows the query instance which returns a list of open channels that partially match the specified NameKeyword keyword in their channel names.

SbOpenChannelListQueryParams queryParams = new SbOpenChannelListQueryParams();
queryParams.NameKeyword = "Sendbird";

SbOpenChannelListQuery query = SendbirdChat.OpenChannel.CreateOpenChannelListQuery(queryParams);
query.LoadNextPage((inChannels, inError) =>
{
    if (inError != null)
        return; //Handle error.
});

The following shows the query instance which returns a list of open channels that partially match the specified UrlKeyword keyword in their channel URLs.

SbOpenChannelListQueryParams queryParams = new SbOpenChannelListQueryParams();
queryParams.UrlKeyword = "seminar";

SbOpenChannelListQuery query = SendbirdChat.OpenChannel.CreateOpenChannelListQuery(queryParams);
query.LoadNextPage((inChannels, inError) =>
{
    if (inError != null)
        return; //Handle error.
});

You can also search for open channels with a specific custom type by setting CustomTypeFilter as in the following code.

SbOpenChannelListQueryParams queryParams = new SbOpenChannelListQueryParams();
queryParams.CustomTypeFilter = "movie";

SbOpenChannelListQuery query = SendbirdChat.OpenChannel.CreateOpenChannelListQuery(queryParams);
query.LoadNextPage((inChannels, inError) =>
{
    if (inError != null)
        return; //Handle error.
});