Documentation Index
Fetch the complete documentation index at: https://learn.social.plus/llms.txt
Use this file to discover all available pages before exploring further.
Add & Remove Reactions
Enable users to express emotions and engage with content through comprehensive reaction management. Build expressive communities where users can add, modify, and remove reactions on posts, stories, comments, and messages with real-time synchronization.Architecture Overview
Key Features
Multi-Content Reactions
Add reactions to posts, stories, comments, and messages
Real-time Updates
Instant reaction synchronization across all clients
Flexible Reaction Types
Support unlimited custom reaction types up to 100 characters
Optimistic Updates
Immediate UI feedback with automatic error handling
Add Reaction
Enable users to express emotions and engagement through reactions. TheaddReaction function provides comprehensive support for all content types with real-time synchronization and optimistic UI updates.
Parameters
reactionName
reactionName
Type:
stringRequired: YesDescription: Name of the reaction to add. Case-sensitive with maximum length of 100 characters.Examples: "like", "love", "wow", "celebrate", "support"Validation:- Maximum 100 characters
- Case-sensitive (“like” ≠ “Like”)
- Alphanumeric and special characters allowed
referenceType
referenceType
Type:
ReactionReferenceTypeRequired: YesDescription: Specifies the type of content to react to.Valid Values:POST- React to posts in feeds and communitiesSTORY- React to ephemeral story contentCOMMENT- React to comments in discussionsMESSAGE- React to messages in chats
referenceId
referenceId
Type:
stringRequired: YesDescription: Unique identifier of the content to react to. Must correspond to existing content of the specified reference type.callback
callback
Type:
FunctionRequired: No (varies by platform)Description: Optional callback function to handle success/error responses. Returns reaction data on success.Implementation
- iOS
- Android
- TypeScript
- Flutter
Remove Reaction
TheremoveReaction function allows users to remove a previously added reaction from content. This provides users with greater control over their engagement and allows them to change their minds or update their reactions over time.
Architecture
Features
Instant Removal
Remove reactions immediately with real-time updates
Reference Support
Remove reactions from posts, stories, comments, and messages
Analytics Tracking
Track removal patterns and user engagement metrics
Error Handling
Comprehensive validation and error management
Parameters
reactionName
reactionName
Type:
stringRequired: YesDescription: The name of the reaction to remove. Names are case-sensitive (e.g., “like” vs “Like” are different reactions).Example: "like", "love", "angry"referenceType
referenceType
Type:
ReactionReferenceTypeRequired: YesDescription: Specifies the type of content to remove reaction from.Valid Values:POST- Remove reaction from postsSTORY- Remove reaction from story contentCOMMENT- Remove reaction from commentsMESSAGE- Remove reaction from messages
referenceId
referenceId
Type:
stringRequired: YesDescription: Unique identifier of the content to remove reaction from.Implementation
- iOS
- Android
- TypeScript
- Flutter
Best Practices
Optimistic Updates
Update UI immediately while processing the reaction in the background for better user experience.
Error Handling
Always implement proper error handling and provide user feedback for failed operations.
State Management
Maintain local reaction state to prevent duplicate operations and enable offline functionality.
Analytics Tracking
Track reaction patterns to understand user engagement and improve content strategy.
Implementation Guidelines
Validation and Error Handling
Validation and Error Handling
- Always validate reaction names and reference IDs before making API calls
- Implement proper error handling for network failures and invalid requests
- Provide meaningful error messages to users
- Use try-catch blocks to handle exceptions gracefully
Performance Optimization
Performance Optimization
- Implement caching to track existing reactions and prevent redundant API calls
- Use debouncing for rapid add/remove operations
- Consider implementing offline support with sync when connection is restored
- Batch multiple reaction operations when possible
User Experience
User Experience
- Provide immediate visual feedback when reactions are added or removed
- Show loading states during API operations
- Handle edge cases like network failures gracefully
- Allow users to undo reaction changes within a reasonable time window
Analytics and Monitoring
Analytics and Monitoring
- Track reaction addition and removal events for engagement analysis
- Monitor API response times and error rates
- Log user interaction patterns to improve UX
- Implement A/B testing for different reaction UI designs
Use Cases
- Comment System
- Story Interactions
- Chat Messages
Error Handling
Common Error Types
Common Error Types
- Network Errors: Handle offline scenarios and poor connectivity
- Validation Errors: Invalid reaction names or reference IDs
- Permission Errors: User lacks permission to react to content
- Rate Limiting: Too many reactions added/removed too quickly
Error Response Examples
Error Response Examples
Recovery Strategies
Recovery Strategies
- Implement retry logic with exponential backoff
- Provide fallback UI states for failed operations
- Cache operations for offline execution when connection is restored
- Show appropriate error messages based on error type