Skip to main content
Enable rich emotional responses to posts, stories, and comments through a comprehensive reaction system. Manage reactions with querying capabilities, add/remove functionality, and detailed analytics to foster engagement and community interaction.

Query Reactions

Retrieve detailed information about reactions on posts, stories, and comments

Add Reactions

Allow users to express emotions with custom reaction names

Remove Reactions

Enable users to change or remove their reactions

Query Reactions

To further facilitate the management of reactions in your app, the social.plus SDK includes a getReactions method that allows you to retrieve information about a specific reaction or all reactions on a comment, post, or story. Using this method, you can fetch detailed information about:
  • User Information: The user who made the reaction
  • Timestamp: When the reaction was created
  • Metadata: Any additional data associated with the reaction
  • Reaction Type: The specific reaction name or emoji used
  • Community Sentiment: Analyze overall reaction patterns
  • Content Performance: Identify types of content that resonate with users
  • User Engagement: Track how users interact with different content
  • Trending Reactions: Discover popular reaction types in your community

Reference Types

The referenceType parameter determines the type of reference for which reactions are queried. Supported values are:
Reference TypeDescription
postRetrieves reactions for a post
storyRetrieves reactions for a story
commentRetrieves reactions for a comment
messageRetrieves reactions to a message

Parameters

ParameterTypeRequiredDescription
referenceIdStringYesID of the post, comment, story, or message
referenceTypeEnumYesType of content being queried for reactions
reactionNameStringNoFilter by specific reaction type (case-sensitive)
var token: AmityNotificationToken?

// Query all reactions for a post
token = reactionRepository.getReactions(
    "<post-id>",
    referenceType: .post,
    reactionName: nil
).observe { liveCollection, changes, error in
    // Handle result here
    guard let reactions = liveCollection.object else { return }
    
    for reaction in reactions {
        print("User: \(reaction.userId)")
        print("Reaction: \(reaction.reactionName)")
        print("Created: \(reaction.createdAt)")
    }
}

// Query specific reaction type
token = reactionRepository.getReactions(
    "<post-id>",
    referenceType: .post,
    reactionName: "like"
).observe { liveCollection, changes, error in
    // Handle filtered results
}

Add / Remove Reactions

The social.plus SDK provides comprehensive functionality for adding and removing reactions on posts. Users can add multiple reactions to express themselves more expressively and remove reactions for greater control over their engagement.

Add Reaction

The addReaction function allows users to add a reaction to a post, comment, story, or message. Users can add any number of reactions to a particular piece of content, enabling more nuanced and expressive engagement.

Key Features

  • Maximum Length: 100 characters per reaction name
  • Case Sensitivity: “like” and “Like” are treated as different reactions
  • Custom Names: Support for any custom reaction name or emoji
  • Unicode Support: Full support for emoji and international characters
  • Post: Adds the reaction to a post
  • Story: Adds the reaction to a story
  • Comment: Adds the reaction to a comment
  • Message: Adds the reaction to a message

Parameters

ParameterTypeRequiredDescription
reactionNameStringYesName of the reaction (max 100 characters, case-sensitive)
referenceIdStringYesID of the post, comment, story, or message
referenceTypeEnumYesType of content receiving the reaction

do {
    let result = try await reactionRepository.addReaction("<reaction-name>", referenceId: "<post-id>", referenceType: .post)
} catch {
    // Handle error here
}

Remove Reaction

The removeReaction function allows users to remove a previously added reaction from a reference. This provides users with greater control over their engagement and allows them to change their minds or update their reactions over time.

Parameters

ParameterTypeRequiredDescription
reactionNameStringYesName of the reaction to remove (case-sensitive)
referenceIdStringYesID of the post, comment, story, or message
referenceTypeEnumYesType of content where the reaction will be removed
Case Sensitivity: Reaction names are case sensitive. “like” and “Like” are treated as two different reactions, so ensure exact matching when removing reactions.
do {
    let result = try await reactionRepository.removeReaction("<reaction-name>", referenceId: "<post-id>", referenceType: .post)
} catch {
    // Handle error here
}

Common Reaction Types

  • like: Basic positive reaction
  • love: Strong positive emotion
  • laugh: Humorous content appreciation
  • wow: Surprise or amazement
  • sad: Empathetic response
  • angry: Strong negative reaction
  • 👍: Thumbs up
  • ❤️: Heart/love
  • 😂: Laughing face
  • 😮: Surprised face
  • 😢: Sad face
  • 😡: Angry face
  • awesome: Community-specific positive reaction
  • helpful: For educational or informative content
  • inspiring: For motivational content
  • fire: For trending or popular content
  • mind-blown: For surprising or impressive content

Best Practices

  • Consistent Naming: Use standardized reaction names across your app
  • User-Friendly: Choose intuitive reaction names that users understand
  • Cultural Sensitivity: Consider cultural differences in emoji and reaction meanings
  • Moderation: Implement guidelines for appropriate reaction usage
  • Debouncing: Prevent rapid add/remove cycles that could spam the system
  • Batch Operations: Group multiple reaction operations when possible
  • Error Handling: Implement robust error handling for network issues
  • Visual Feedback: Provide immediate visual feedback when reactions are added/removed
  • Reaction Counts: Display reaction counts and types clearly
  • User Lists: Show who reacted with what reaction types

Use Cases

Social Feeds

Enable reactions on posts in social media feeds

Content Moderation

Use reaction patterns to identify popular or problematic content

Community Engagement

Foster community interaction through expressive reactions

Content Analytics

Analyze user sentiment and content performance

Gamification

Use reactions as part of engagement and reward systems

Feedback Loops

Gather user feedback on different types of content