Reactions

Stream Chat supports message reactions such as likes, hearts, and custom reaction types. Users can react to messages, and reactions can include custom data and scores for cumulative reactions.

Sending a Reaction

Add a reaction to a message using the sendReaction method. Each user can have one reaction of each type per message.

// Send a reaction with default score of 1
await message.SendReactionAsync("like");

// Send a reaction with custom score
await message.SendReactionAsync("clap", 10);

// Replace all previous reactions from this user
await message.SendReactionAsync("love", enforceUnique: true);

Reaction Parameters

NameTypeDescriptionDefaultOptional
message_idstringID of the message to react to
typestringReaction type. Each user can have one reaction of each type per message.
scoreintegerScore for cumulative reactions1
user_idstringUser ID (required for server-side calls)
enforce_uniquebooleanIf true, replaces all existing reactions from this user with the new onefalse
skip_pushbooleanIf true, do not send a push notificationfalse
emoji_codestringUnicode emoji for push notification display
custom dataobjectCustom fields for the reaction

Custom data for reactions is limited to 1KB.

Removing a Reaction

Remove a reaction by specifying the message ID and reaction type.

await message.DeleteReactionAsync("like");

Retrieving Reactions

Reactions are included in the message object. Messages returned by the API include the 10 most recent reactions.

Reaction Fields in Messages

FieldTypeDescription
reaction_countsobjectCount of reactions per type. Example: {"love": 3, "fire": 2}
reaction_scoresobjectSum of scores per type. Equals counts for standard reactions; differs for cumulative reactions.
reaction_groupsobjectDetailed statistics per type including count, sum_scores, first_reaction_at, last_reaction_at
latest_reactionsarrayThe 10 most recent reactions with type, user_id, and created_at
own_reactionsarrayThe current user's reactions on this message

Use reaction_groups instead of reaction_counts for if you're building a custom implementation. The reaction_groups field provides additional metadata including timestamps and is the recommended approach.

To retrieve more than 10 reactions, use pagination.

Paginating Reactions

Retrieve reactions with pagination using limit and offset parameters.

ParameterMaximum Value
limit300
offset1000
// Paginating reactions via API is not yet available in the Unity SDK.
// Please let us know if you'd like this feature implemented: https://github.com/GetStream/stream-chat-unity/issues
// Each message exposes a snapshot of the reaction summary instead:

// The 10 most recent reactions on the message
foreach (var reaction in message.LatestReactions)
{
    Debug.Log($"{reaction.Type} from {reaction.User?.Id}");
}

// The 10 most recent reactions left by the local user
foreach (var reaction in message.OwnReactions)
{
    Debug.Log($"My reaction: {reaction.Type}");
}

// Number of reactions per type, e.g. {"love": 3, "fire": 2}
foreach (var entry in message.ReactionCounts)
{
    Debug.Log($"{entry.Key}: {entry.Value} reactions");
}

// Sum of reaction scores per type (matches counts unless cumulative reactions are used)
foreach (var entry in message.ReactionScores)
{
    Debug.Log($"{entry.Key}: total score {entry.Value}");
}

Querying Reactions

Filter reactions by type or user on a specific message. This endpoint requires the user to have read permission on the channel when called client-side.

// This feature is not yet available in the Unity SDK.
// Please let us know if you'd like this feature implemented: https://github.com/GetStream/stream-chat-unity/issues

Cumulative Reactions

Cumulative reactions allow users to react multiple times to the same message, with the total score tracked. This is useful for features like Medium's "clap" functionality.

Set a score value when sending the reaction. The API returns:

  • sum_scores: Total score across all users
  • Individual user scores
await message.SendReactionAsync("clap", score: 5);