Skip to main content

Customizing User Notification Feed

Overview​

The LikeMinds platform allows you to create custom activities in a user's notification feed programmatically. This guide will walk you through the process of generating custom notification feed entries using the Create Notification Feed Activity API.

Prerequisites​

Before creating custom notification feed activities, ensure you have:

  1. Enabled Feed in your project

  2. Authentication

    • Obtain a CM/Admin access token by calling the Initiate API
    • Only users with Admin or community manager (CM) privileges can create custom activities

Authentication Steps​

  1. Call the sdk/initiate API- ref :

    curl --location 'https://auth.likeminds.community/sdk/initiate' \
    --header 'x-api-key: LM_API_KEY' \
    --data '{
    "user_name": "ADMIN_NAME",
    "user_unique_id": "ADMIN_UUID"
    }'
  2. Extract the access_token from the response for subsequent API calls.

Creating Custom Notification Feed Activity​

API Endpoint​

Request Body Example​

{
"action": "custom_activity",
"action_by": "user_john_123",
"action_on": [
"user_mary_456",
"user_alice_789",
"user_admin_234"
],
"entity_type": "post",
"entity_id": "post_id_abc",
"activity_text": "John created a new post in Marketing topic"
}

Use Case Breakdown:

  • John (user_john_123) creates a post
  • The activity is sent to Mary, Alice, and an admin
  • The post is about marketing, with ID post_id_abc
  • Notification text explains the action clearly

Example Request​

curl --location 'https://auth.likeminds.community/feed/user/activity' \
--header 'Authorization: ADMIN_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"action": "custom_activity",
"action_by": "USER_UUID_A",
"action_on": ["USER_UUID_B", "USER_UUID_C"],
"entity_type": "post",
"entity_id": "abc123",
"activity_text": "John created a new post in Marketing topic"
}'

Possible Responses​

  1. Successful Creation (200 OK):

    {
    "success": true
    }
  2. Authorization Error:

    {
    "success": false,
    "error_message": "You are not Authorized to perform this action"
    }

Verifying Custom Activity​

To confirm the custom activity was created, retrieve the user's notification feed:

curl --location 'https://auth.likeminds.community/feed/user/activity' \
--header 'Authorization: <USER_ACCESS_TOKEN>'

Best Practices​

  1. Rate Limiting: Be mindful of how frequently you create custom activities to avoid overwhelming users.

  2. Meaningful Content: Ensure the activity_text provides clear, contextual information.

  3. Targeted Notifications: Use action_on carefully to send notifications to relevant users.

  4. Error Handling: Always implement robust error handling for API calls.

  5. Testing: Always test in a staging environment before deploying to production.

Common Use Cases​

  • Announcing user achievements
  • Highlighting community milestones
  • Creating custom engagement notifications
  • Notifying about special events or promotions
  • Combining this API with Likeminds webhooks to create dynamic, real-time notification experiences.

Additional Resources​