Reactions

LAST EDIT May 12 2021

Adding Reactions

Copied!

Reactions are a special kind of data that can be used to capture user interaction with specific activities. Common examples of reactions are likes, comments, and upvotes. Reactions are automatically returned to feeds' activities at read time when the reactions parameters are used.

Reactions are always related to activities; in order to add a reaction to an activity you need to provide its ID.

Parameters

Copied!

The ID of the activity the reaction refers to

nametypedescriptiondefaultoptional
kindstringThe type of reaction (eg. like, comment, ...)-
activity_idstring-
dataobjectAdditional data to attach to the reaction-
target_feedsarrayThe feeds that should receive a notification activity-
target_feeds_extra_dataobjectAdditional data to attach to the notification activities-

Here's a complete example:

Retrieving Reactions

Copied!

You can read reactions and filter them based on their user_id or activity_id values. Further filtering can be done with the kind parameter (e.g. retrieve all likes by one user, retrieve all comments for one activity, etc.).

Reactions are returned in descending order (newest to oldest) by default and when using id_lt[e] , and in ascending order (oldest to newest) when using id_gt[e].

Parameters

Copied!
nametypedescriptiondefaultoptional
activity_idstringRetrieve reactions by activity_id-
user_idstringRetrieve reactions by user_id-
reaction_idstringRetrieve children reaction by reaction_id-
kindstringIf provided it will only retrieve reactions of a certain kind (e.g. "like")-
limitintegerThe number of reactions to retrieve 10
id_gtestringRetrieve reactions created after the on with ID equal to the parameter (inclusive)-
id_gtstringRetrieve reactions created after the one with ID equal to the parameter.-
id_ltestringRetrieve reactions created before the one with ID equal to the parameter (inclusive)-
id_ltstringRetrieve reactions before the one with ID equal to the parameter-
with_activity_databooleanReturns activity data when paginating using activity_id-

Updating Reactions

Copied!

Reactions can be updated by providing reaction ID parameter. Changes to reactions are propagated to all notified feeds; if the target_feeds list is updated, notifications will be added and removed accordingly.

Parameters

Copied!
nametypedescriptiondefaultoptional
reaction_idstringThe ID of the reaction-
dataobjectReaction data-
target_feedsstringThe list of feeds that should receive a copy of the reaction.-

Removing Reactions

Copied!

Reactions are easy to remove. Simply pass in their ID, like so: