Let users react to messages, posts, and comments, which are visible to others
Reactions are the interactions that users can perform on messages, posts, or comments. The interactions can be anything such as like, dislike, love, etc. It's up to the client to determine the type of reactions. The SDK provides convenient functions to add, remove, and query reactions for any content. Currently, reactions are supported for Posts, Messages, and Comments.
The Social SDK provides two reference types for querying reactions: comment reference type and post reference type.
Comment Reference Type: allows users to query reactions made on a specific comment. This is useful when users want to see how others have responded to a particular comment.
Post Reference Type: allows users to query reactions made on a specific post. This is helpful when users want to see how others have engaged with a particular piece of post.
Name
Data Type
Description
Attributes
referenceId
String
ID of a document
referenceType
String
Type of document
reactionName
String
Name of reaction
'like
', 'love
' , 'wow
'
reactionId
String
ID of the reaction
reactorId
String
ID of the reactor
reactorDisplayName
String
Display name of the reactor
createdAt
DateTime
The date/time when a reaction is created
To further facilitate the management of reactions in your app, the Social SDK product includes a getReactions
method that allows you to retrieve information about a specific reaction or all reactions on a comment and post.
Using this method, you can fetch detailed information about a particular reaction, including the user who made the reaction, the timestamp of the reaction, and any additional metadata associated with the reaction. This can be useful for analyzing the sentiment of the community and gaining insights into the types of content that are resonating with your users.
To query getReactions
you'll need to simply provide referenceType
and referenceId
to query specific type of reactions. For further information regarding reaction reference types, please see - #create-comment.
Each post, comment, message has a set of fields providing detailed info about reactions.
reactionsCount
- how many reactions the post has
myReactions
- list of reactions you added to the post
reactions
- map that tells how many reactions of a certain type a post has
Version 6
Beta(v0.0.1)
The Social SDK product also provides functionality for adding and removing reactions on posts. Users can add any number of reactions to a particular post, allowing them to engage with the content in a more expressive and nuanced way. Additionally, users can also remove reactions that they have added to a post, providing greater control and flexibility over their engagement with the content.
The addReaction
function allows users to add a reaction to a post. The function takes the name of the reaction as a parameter, with a maximum length of 100 characters. The reaction name is case-sensitive, which means that "like" and "Like" are treated as two different reactions.
You can add reactions to a given reference through the addReaction
method.
referenceId
- ID of the post or comment respectively.
reactionName
- name of the reaction that you will remove. Reaction name is case sensitive, i.e "like" & "Like" are two different reactions.
The method returns a promise. If the reaction is successfully removed, the method will return true
. Otherwise, it will return false
or an error.
Version 6
Beta (v0.0.1)
Similarly, the removeReaction
function allows users to remove a previously added reaction from a reference. This provides users with greater control over their engagement with the content and allows them to change their mind or update their reaction to the post or comment over time.
You can remove a reaction from a reference by calling removeReaction
.
reactionName
- name of the reaction that you will remove. Reaction name is case sensitive, i.e "like" & "Like" are two different reactions.
referenceId
- ID of the post or comment respectively.
The method returns a promise. If the reaction is successfully removed, the method will return true
. Otherwise, it will return false
or an error.
Version 6
Beta (v0.0.1)