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:
Enabled Feed in your project
- Use the Community Settings API Update Community Settings to enable the feed functionality for your community.
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
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"
}'Extract the
access_token
from the response for subsequent API calls.
Creating Custom Notification Feed Activity
API Endpoint
- Method: POST
- URL:
/feed/user/activity
- Authentication: Bearer Token (Admin/CM token)
- API Doc: Create Notification Feed Activity API
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
Successful Creation (200 OK):
{
"success": true
}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
Rate Limiting: Be mindful of how frequently you create custom activities to avoid overwhelming users.
Meaningful Content: Ensure the
activity_text
provides clear, contextual information.Targeted Notifications: Use
action_on
carefully to send notifications to relevant users.Error Handling: Always implement robust error handling for API calls.
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.