Filter Surface
Parameters
Query A Channel List
Query channels with type, membership, tag, deletion, archive, search, and pagination options where each platform exposes them.Sort A Channel List
UsesortBy to choose how a channel list is ordered. Choose lastMessage for an inbox that should follow the conversation, so that joining or leaving a channel does not push it to the top.
Each platform names the values in its own style:
- Live order. The collection reorders as messages arrive. When the current user sends a message, that channel moves to the top right away, before the server responds.
lastMessageAt. The channel’slastMessageAtis the time of its newest message, or its creation time if it has none. UnlikelastActivity, membership changes and closing the channel do not change it. It isnull(nilon iOS) when the backend has no value for the channel yet, and those channels are listed last, ordered by creation time. Read it aschannel.getLastMessageAt()on Android,channel.lastMessageAton iOS, andchannel.lastMessageAton TypeScript.- Backend support.
lastMessageneeds backend support for your network. Until it is available, the query fails with HTTP status 422 and error code500000. The SDK does not retry and does not fall back tolastActivity, so handle the error in your query callback. On iOS,error.isAmityErrorCode(.business)identifies it, and on TypeScript the code isAmity.ServerError.BUSINESS_ERROR. On Android, the error arrives asLoadState.Errorin the paging load state, not in thesubscribeerror callback.AmityError.from(error) == AmityError.BUSINESS_ERRORidentifies it.
Flutter’s
sortBy currently accepts LAST_ACTIVITY only. On TypeScript, sortBy also accepts lastCreated, firstCreated, and displayName.Query A Specific Type
Use the type-specific helpers when the platform exposes them. Some helpers apply membership defaults: for example, Flutter’sconversationType() and liveType() also set the filter to MEMBER.
Use type-specific channel queries when your UI needs a focused list such as conversations or live channels.
Known IDs
If you already have channel IDs, use Get Channels instead of a filtered query. Batch get-by-IDs is currently exposed on TypeScript, iOS, and Android.Related Topics
Create Channels
Create a channel before it appears in query results.
Get Channels
Retrieve a single channel or a known list of IDs.
Archive Channels
Hide or restore archived conversation channels where supported.
Query Members
Query members after selecting a channel.