Reactions
Reactions are the interactions that you can perform on messages, posts, or comments. The interactions can be anything such as like, dislike, love, etc. It's up to you to determine the type of reactions.
AmityReactionRepository
class provides a convenient method to add, remove, and query reactions for any content. Currently, reactions are supported for Posts, Messages and Comments.
Reaction Description
Name | Data Type | Description | Attributes |
|
| ID of a document | |
|
| Type of document | |
|
| Name of reaction | ' |
|
| ID of the reaction | |
|
| ID of the reactor | |
|
| Display name of the reactor | |
|
| The date/time when a reaction is created |
Query Reactions
You can fetch detailed information about reactions and the user who reacted to the post. AmityPostRepository
and AmityCommentRepository
classes provide two methods which get detailed information about reactions to the post and comment respectively. Each information is provided through AmityReaction
object.
You can fetch information about a particular reaction and all the reactions through the getReactions
method. The method returns collections of AmityReaction
.
Reaction Query for Post
Follow the queryPostReaction()
function to get reactions from a post:
Reaction Query for Comment
Follow queryCommentReaction()
function to get reactions from a comment.
Add/Remove Reaction
You can add any reactions to a given post. You can also remove any reactions added to the post. AmityPost
and AmityComment
objects provide addReaction
and removeReaction
methods for adding and removing reactions respectively. Both methods accept the reactionName
the the required parameter.
Add Post Reaction
Follow addPostReaction()
function to add reaction to a post.
Add Comment Reaction
Follow addCommentReaction()
function to add reaction to a post.
Remove Post Reaction
Follow removePostReaction()
function to remove a reaction from a post.
Remove Comment Reaction
Follow removeCommentReaction()
function to remove a reaction from a comment.
The reactionName
parameter is the reaction name. This can be "like", "love", "wow" and other reaction names which has a maximum length of 100 characters. It is case sensitive. This means that "like" and "Like" are two different reactions.
Last updated