Communities
Here's an overview of how you can start integrating comments into your applications.

Create Repository

Community Description

Name
Data Type
Description
Attributes
communityId
String
ID of the community
channelId
String
ID of the channel
userId
String
ID of the user who created the community
displayName
String
Community name for displaying
avatarFileId
String
ID of the avatar file
description
String
Description of the community
isOfficial
Boolean
Is this community official?
isPublic
Boolean
Is this community public?
onlyAdminCanPost
Boolean
Can post by admin only?
tags
Array.<String>
List of tags used for searching
metadata
Object
Additional properties to support custom fields
postsCount
Integer
Number of posts in community
membersCount
Integer
Number of members in community
isJoined
Boolean
Is this community joined?
categoryIds
Array.<String>
ID of categories
isDeleted
Boolean
Is this community deleted?
Default: false
createdAt
String($date-time)
Date/time when the community was created
updatedAt
String($date-time)
Date/time when a community is updated or deleted
hasFlaggedComment
Boolean
Flag for checking internally if comment inside post is reported or not
Default: false

Create Community

When creating a new community, first instantiates the AmityCommunityRepository, a class that contain all community related methods. Then call createCommunity() to obtain the RxJava and observe it in order to obtain the final community model.

With Avatar

If you prefer create community with an avatar you can first upload image with AmityFileRepository then pass the obtained AmityImageto createCommunityAPI.

Step 1.

Step 2.

Join Community

The joinCommunity() method will add the active user as a member of the channel.
This API can be called as many time as needed. If the community has already been joined, a "success" result will be returned, ie., going into doOnComplete{}block.

Leave Community

Get Community

In the case where you only want to fetch community data without joining, you can use the getCommunity(:id) method:

Community Query

There are methods to obtain communities that only match specific criteria:
  • the withKeyword parameter let you filter communities based on the community displayName
  • the sortBy parameters let you filter communities based on the order that the communities were created or based on alphabetical order
  • the filter parameter let you filter communities based on the logged-in user membership status
  • the categoryId parameters let you filter communities based on community categories

Enum Types

Trending and Recommended Communities

Community Repository provides a way to fetch trending and recommended communities.
  • Trending communities
    This is a list of communities with the highest number of members. It can be a combination of communities where the user may or may not be part of.
  • Recommended communities
    This is a list of communities with the highest member count. The communities in the list are those that the user is not part of.

Update Community

If you want to update a community, you can call the following:
By default, only the community's original creator or administrators can update the community.

Community Membership

You can get a list of community members by calling the following method:

Enum Types

AmityCommunityMembershipFilter

1
AmityCommunityMembershipFilter.ALL
2
AmityCommunityMembershipFilter.BANNED
3
AmityCommunityMembershipFilter.MEMBER
4
AmityommunityMembershipFilter.NONE
Copied!

AmityCommunityMembershipSortOption

1
AmityCommunityMembershipSortOption.FIRST_CREATED
2
AmityCommunityMembershipSortOption.LAST_CREATED
Copied!
The default value of sortBy is LAST_CREATED so you can skip .sortBy in builder.

Role and Permission

Creator of community can add and remove role of user via AmityCommunityModeration.

Role

You can add or remove default roles as well as custom roles.

Query memberships by role

The AmityCommunityParticipation provides a list of members by role in the given community.

Permission

You can check your permission in community by sending AmityPermission enums to AmityCoreClient.hasPermission(amityPermission) method.

Community Categories

The AmityCommunityRepository will also be able to manage community categories. When communities are put into a category, you will be able to sort and filter each of the communities in that category.
Note. Right now categories will only be creatable and updatable from the Amity Social Cloud Console.

Category Query

This method provides the ability to obtain all the categories.
The default of sortBy is NAME so you can skip .sortBy in builder

Post Review

Allow users to create posts in a community. Then, create another layer of moderation to allow community owners to decide whether the post should reflect on the feed.

Post count with FeedType

AmityCommunity.kt model allows user to get post count by feed type .

Permission

If you want to check permission review post on community, you can use this enum.
AmityPermission.REVIEW_COMMUNITY_POST by following this:

Post Approval

AmityCommunity.kt model allow user can get status of isPostReviewEnabled() .

Create Community

If you want to create a community and need to review post before they're added to your community feed, you can call the following:
The isPostReviewEnabled value is published by default. If you do not call this function, all member posts will be shown in community feed immediately without reviewing.

Update Community

If you want to update the community and change the status of isPostReviewEnable, you can call the following:

Delete Community

You can delete a community by calling the deleteCommunity method. It accepts the community ID of the community to delete as the required parameter.