Query Members
The ability to search for and query members within a chat channel is an essential feature for creating a seamless and engaging user experience. With Amity Chat SDK, developers can use the query member feature to allow users to search for and retrieve member information within a channel. We will discuss how to use the query member feature of Amity Chat SDK to enable users to search and retrieve member information within a chat channel.
iOS
Android
JavaScript
TypeScript
Flutter
All participation related methods in a channel fall under a separate
ChannelParticipation
class.All participation related methods in a channel fall under a separate
ChannelParticipation
class.You can get a list of all members, or add
memberships
, roles
, search
parameters to get certain members of the channel.import { ChannelRepository, MemberFilter } from '@amityco/js-sdk';
let members;
const liveCollection = ChannelRepository.queryMembers({
channelId: 'channel1',
memberships: [MemberFilter.Member],
roles: ['role1'],
search: 'asd',
});
liveCollection.on('dataUpdated', newModels => {
members = newModels;
});
liveCollection.on('dataError', error => {
console.error(error);
});
members= liveCollection.models;
Version 6
Beta (v0.0.1)
Last modified 7d ago