ClickCease
Abstract visualisation of in-app communities that users can follow that was build with TypeScript

Easily implement community recommendations in TypeScript

Italo Orihuela
Engineer
Android
iOS
Web
Feb 1, 2024

As a developer, one of the key aspects of building a successful online platform is to ensure that it is dynamic, engaging, and inclusive. This is where the concept of recommended and trending communities comes into play. By showing users recommended communities, you can suggest new groups that they might be interested in, based on their activity and interests. On the other hand, trending communities highlight the most active groups, encouraging users to join the conversation and engage with other members. This not only enhances user experience but also fosters a sense of community and belonging among users. In this tutorial, we will guide you on how to fetch recommended and trending communities using TypeScript and the Social+ SDK.

Pre-requisites:

Before we begin, ensure that you have the following requirements:

  1. Basic knowledge of TypeScript.
  2. The Social+ SDK installed in your project. You can install it using npm with the command npm install @amityco/ts-sdk.
  3. An Social+ Portal account
  4. An Social+ Console Account

Note: If you haven’t already registered for an Social+ account, we recommend following our comprehensive step-by-step guide in the Social+ Portal to create your new network.

Step 1: Importing the Required Modules

The first step is to import the necessary modules from the Social+ SDK. We will need the CommunityRepository for fetching the recommended and trending communities.

Step 2: Fetching Recommended Communities

The getRecommendedCommunities method fetches communities that are currently having high levels of members where the user is not part of. This can be used to suggest new communities for the user to join. Here's how you can use it:

This function fetches the top 5 recommended communities and logs them to the console. The unsubscribe function is used to unsubscribe from the data stream when you're done with it.

Step 3: Fetching Trending Communities

The getTrendingCommunities method fetches communities that are currently having high levels of members where the user may or may not be part of. This can be used to show the user what's currently popular. Here's how you can use it:

This function fetches the top 5 trending communities and logs them to the console.

Final Thoughts:

In this tutorial, we’ve explored how to harness the power of community recommendations using TypeScript and the Social+ SDK. By implementing these white-label social features, you can enhance user engagement and foster a more dynamic and inclusive community atmosphere in your app. Remember, the key to a thriving online community is engagement, and with these tools at your disposal, you’re well on your way to achieving that!

This is some text inside of a div block.
This is some text inside of a div block.