Issue with Updating customPostRanking via Network Settings API

Hi Team,

I attempted to update the network settings using the following API call:

PUT https://api.sg.amity.co/api/v3/network-settings/social

Payload:

{
  "enabled": true,
  "membershipAcceptance": "automatic",
  "userPrivacySetting": "public",
  "isFollowWithRequestEnabled": false,
  "isAllowEditPostWhenReviewingEnabled": true,
  "disallowNonMemberInteractInCommunity": false,
  "globalFeed": {
    "showOnlyMyFeed": false,
    "showMyPost": true,
    "showEveryonePost": false,
    "showCommunityPost": true,
    "showFollowingPost": true,
    "maxGlobalPinnedPost": 1
  },
  "customPostRanking": {
    "enabled": true,
    "score": "(2 * commentsCount + reactionsCount + 1) * (10 * exp_decay(time_diff(createdAt), 0.5) + 1) * log_logistic_decay(time_diff(createdAt), 3, 2)",
    "skipCustomPostRankingRedirect": false
  },
  "story": {
    "allowAllUserToCreateStory": false,
    "expiryTimeMinutes": 1440
  },
  "allowJoinPrivateCommunity": true
}

My aim was to change the customPostRanking.score parameter. Although I received a success status (200), the change does not seem to take effect.

Could you please assist in identifying what I might be missing or what additional steps are required?

Thank you for your help.

Best regards,

Hello @duongnb, could you please share the previous formula you were using before switching to this one — was it the default formula?

To help us recommend the most suitable formula, could you also share your use case and how you’d like your feeds or posts to be sorted?

Yes, this is default formula. I just aim to increase priority for most recent post rather than old with high comment and interaction.

Hi team, do you have any solution for me?

Hello @duongnb, thank you for following up and for your patience. Please try again using the following cURL.

curl https://api.sg.amity.co/api/v3/network-settings/social \
  --request PUT \
  --header 'Content-Type: application/json' \
  --data '{
  "customPostRankingFormula": "(2 * commentsCount + reactionsCount + 1) * (10 * exp_decay(time_diff(createdAt), 0.5) + 1) * log_logistic_decay(time_diff(createdAt), 3, 2)"
}'

Our team suggests modifying the expression 2 * commentsCount + reactionsCount as needed until it produces the desired result.

I got it. Thank for your help.

1 Like