Retrieve a list of channels
You can retrieve a list of open channels using OpenChannelListQuery's loadNext() method, which returns a list of OpenChannel objects.
You can also retrieve a list of the current user's private group channels using the loadNext() method of a GroupChannelListQuery instance, which returns a list of GroupChannel objects. Using the includeEmptyChannel property of a GroupChannelListQuery instance, you can determine whether to include empty channels in the result. Empty channels are group channels that have been created but don't contain any messages, and thus aren't included in the result by default. However, if you turn off the Chat history option on Sendbird Dashboard, you may retrieve empty channels in the result.
Note: See search group channels by name, URL, or other filters to find out how to search for specific group channels using keywords and filters.
Open channel
Create an OpenChannelListQuery instance to retrieve a list of open channels matching the specifications set by OpenChannelListQuery. After a list of open channels is successfully retrieved, you can access the data of each open channel from the result list through the openChannel parameter of the callback method.
Group channel
Create a GroupChannelListQuery instance to retrieve a list of group channels matching the specifications set by GroupChannelListQuery.
You can set GroupChannelListQuery's includeEmptyChannel property to true so that users can view empty channels since the view chat history option is turned off to prevent new members from seeing previous conversations. You can determine whether to turn on the chat history option on Sendbird Dashboard under Settings > Chat > Channels > Group channels.
After a list of group channels is successfully retrieved, you can access the data of each channel from the result list through the groupChannel parameter of the callback method.
List of properties
| Property name | Type | Description |
|---|---|---|
includeEmptyChannel | bool | Determines whether to include empty group channels in the results. |
memberStateFilter | MemberStateFilter | Restricts the search scope based on the state of the current user. Acceptable values are |
order | GroupChannelListOrder | A list of user IDs invited to the channel. Acceptable values are |
limit | int | Specifies the number of results to return per call. Acceptable values are |
All public group channels
If you want to retrieve a list of all public group channels regardless of the current user's membership status, use the PublicGroupChannelListQuery instance and set PublicGroupChannelMembershipFilter to PublicGroupChannelMembershipFilter.all in PublicGroupChannelListQuery.
After a list of public group channels is successfully retrieved, you can access the data of each channel from the result list.
Supergroup channels
To retrieve a list of Supergroup channels, you can set the superChannelFilter property to SuperChannelFilter.superChannel in either the GroupChannelListQuery or PublicGroupChannelListQuery instance. The superChannelFilter property works much like other search filters. Use GroupChannelListQuery when only searching for group channels that the current user belongs to, and use PublicGroupChannelListQuery when searching for all public group channels regardless of the current user's membership status.
When queried channels are returned, you can check if the channel is a Supergroup channel by looking at whether the isSuper property has a value of true.