Skip to main content

How to enable personalised feed?

Introduction

In this guide, you'll learn how to enable and configure a personalized feed for users in your Flutter app using the LikeMinds Feed Flutter SDK. A personalized feed helps enhance user engagement by tailoring the content they see based on their preferences, interactions, and other metrics.

Prerequisites

Before you begin, ensure the following:

  • Basic Understanding of Flutter: Familiarity with Flutter widgets and navigation.
  • Basic knowledge of Postman or equivalent API testing tools.

Steps

Step 1: Initiate a user session

Authenticated API calls to the LikeMinds backend require an authorization token. This token can be generated using this Getting Strated doc. Make sure to log in with the Community Manager's credentials.

Step 2: Enable personalised feed

To enable the personalized feed, you need to update the community settings with the following cURL request:

curl --location --request PUT 'https://auth.likeminds.community/community/settings' \
--header 'Authorization: {cm_access_token}' \
--header 'Content-Type: application/json' \
--data '{
"community_settings": [
{
"enabled": true,
"setting_sub_title": "Enable personalised feed in community",
"setting_title": "Enable personalised feed",
"setting_type": "enable_personalised_feed"
}
]
}'

Step 3: Set weigths for different metrics

The personalized feed relies on various metrics such as likes, comments, recency, and user interactions. Set the weights for these metrics using the following cURL request:

curl --location --request PATCH 'https://betaauth.likeminds.community/community/configurations' \
--header 'Content-Type: application/json' \
--header 'Authorization: {cm_access_token}' \
--data '{
"description": "Personalised feed weights metadata for the community",
"type": "personalised_feed_weights",
"value": {
"comments_metrics": {
"max_threshold": 200,
"weight": 10
},
"likes_metrics": {
"max_threshold": 100,
"weight": 5
},
"post_dampening_metrics": {
"max_threshold": 100,
"weight": 5
},
"recency_metrics": {
"max_threshold": 100,
"weight": 5
},
"user_groups_metrics": {
"max_threshold": 50,
"weight": 2
},
"user_topics_metrics": {
"max_threshold": 100,
"weight": 5
},
"user_connection_metrics": {
"max_threshold": 100,
"weight": 5
}
}
}'
note

The sample values in the cURL are subjective in nature, please change it as per your user group.

Step 4: Initiate Flutter Feed SDK and Navigate to Personalised Feed Screen

  1. Follow the Getting Started doc to initialize Flutter Feed SDK using showFeedWithApiKey() or showFeedWithoutApiKey() method accroding to your flow.
  2. To navigate to the personalized feed screen, use the LMFeedScreen widget with the feedType set to LMFeedType.personalised.
if (response.success) {
MaterialPageRoute route = MaterialPageRoute(
builder: (context) => const LMFeedScreen(
feedType: LMFeedType.personalised,
),
);

Navigator.pushReplacement(context, route);
}