Reactions

Let users react to messages, posts, and comments, which are visible to others.

Reactions are the interactions that user 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. 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

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

String($date-time)

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. AmityReactionRepository class provides two methods which gets detailed information about reactions to the post. Each information is provided though AmityReaction object.

You can fetch information about a particular reaction and all the reactions through the getReactions method. This method requires: referenceId , reactionName and referenceType as a parameter and provides you with collections of AmityReaction. referenceId is the reference id for Post, Message or Comment.

Add/Remove Reaction

You can add any number of reactions to the given post. You can also remove any reactions added to the post. AmityReactionRepository provides addReaction and removeReaction methods for adding and removing reactions respectively. Both methods accept the reaction name and postId as parameters.

Add Reaction

Remove Reaction

The reaction 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