Activity Feeds V3 is in closed alpha — do not use it in production (just yet).

Reactions

Overview

You can react to both activities and comments. It’s possible to configure any reaction types that best fit your app.

// Add a reaction to an activity
const addResponse = await client.addReaction({
  activity_id: "activity_123",
  type: "like",
  custom: {
    emoji: "❤️",
  },
});

console.log(addResponse.reaction);

// Adding a reaction without triggering push notifications
await client.addReaction({
    activity_id: "activity_123",
    type: "like",
    custom: {
        emoji: "❤️",
    },
    skip_push: true,
});

// Add a reaction to a comment
await client.addCommentReaction({
  comment_id: "comment_456",
  type: "like",
  custom: {
    emoji: "👍",
  },
});

// Adding a comment reaction without triggering push notifications
await client.addCommentReaction({
  comment_id: "comment_456",
  type: "like",
  custom: {
    emoji: "👍",
  },
  skip_push: true,
});

const deleteResponse = await client.deleteActivityReaction({
  activity_id: "activity_123",
  type: "like",
});

console.log(deleteResponse.reaction);

By default creating a reaction doesn’t create an activity.

When you read a feed the reactions are included. Here’s an example:

const feed = client.feed("user", "sara");
await feed.getOrCreate();

console.log(feed.state.getLatestValue().activities?.[0].own_reactions);
console.log(feed.state.getLatestValue().activities?.[0].latest_reactions);
console.log(feed.state.getLatestValue().activities?.[0].reaction_groups);
© Getstream.io, Inc. All Rights Reserved.