Community Membership

You can get a list of community members by calling the getCommunityMembers method. It accepts the following parameters:

Required parameter

  • communityId - the ID of the community to query

Optional parameters

  • memberships - filter for membership type. The possible values are: (see CommunityUserMembership)

    • 'none' - not a member of the community

    • 'member' - member of the community

    • 'banned' - member banned from the community

  • roles - filter members by specific role. To query members with the default moderator roles assigned, you can use 'channel-moderator' , 'community-moderator'. At this moment, we do not have a way to query for member-only roles. However, if you have assigned a custom role to a member in the community, you can pass in the roleId of the custom role to filter members by this role.

Please note that you can only assign custom roles to a member in a community via the SDK. This feature is not available yet on Amity Console.

Applying a custom role to a user via Amity Console will only apply the role at the user-level, and not at the community level, and if you try to query for a member with this custom role, no results will be returned.

  • sortBy - sorting method to arrange the returned collection. The possible values are: (see CommunitySortingMethod)

    • 'firstCreated'

    • 'lastCreated'

    • 'displayName'

Below is the sample code to get a list of community members. This method will return a LiveCollection instance.

Last updated