# Reactions and Feeds

## Read Feeds with Reactions

When using reactions, it is possible to request enriched activities that include both attached reactions by type and reaction counters.

Listed below are the parameters for retrieving reactions.

<admonition type="info">

The "recent" parameter includes up to 5 of the most recent reactions per type

</admonition>

### Parameters

| name    | type    | description                                                  | default | optional |
| ------- | ------- | ------------------------------------------------------------ | ------- | -------- |
| recent  | boolean | Include the 5 most recent reactions to activities per type.  | -       | ✓        |
| own     | boolean | Include the current user's reaction to activities.           | -       | ✓        |
| counts  | boolean | Include the total count of reaction (by kind) to activities. | -       | ✓        |
| user_id | string  | Filter reactions to specific user.                           | -       | ✓        |

<Tabs>

```csharp label="C#"
// read bob's timeline and include most recent reactions to all activities and their total count
await client.Feed("timeline", "bob").GetEnrichedFlatActivitiesAsync(GetOptions.Default.WithReaction(ReactionOption.With().Recent().Counts()));

// read bob's timeline and include most recent reactions to all activities and her own reactions
await client.Feed("timeline", "bob").GetEnrichedFlatActivitiesAsync(GetOptions.Default.WithReaction(ReactionOption.With().Recent().Own()));
```

```js label="JavaScript"
// read bob's timeline and include most recent reactions to all activities and their total count
client.feed("timeline", "bob").get({
  reactions: { recent: true, counts: true },
});

// read bob's timeline and include most recent reactions to all activities and her own reactions
client.feed("timeline", "bob").get({
  reactions: { own: true, recent: true, counts: true },
});
```

```python label="Python"
# read bob's timeline and include most recent reactions to all activities and their total count
client.feed("timeline", "bob").get(reactions={"recent": True, "counts": True})

# read bob's timeline and include most recent reactions to all activities and her own reactions
client.feed("timeline", "bob").get(
  reactions={"own": True, "recent": True, "counts": True}, user_id="bob"
)
```

```ruby label="Ruby"
# read bob's timeline and include most recent reactions to all activities and their total count
client.feed("timeline", "bob").get(reactions: {recent: true, counts: true})

# read bob's timeline and include most recent reactions to all activities and her own reactions
client.feed("timeline", "bob").get(
  reactions: {own: true, recent: true, counts: true},
  user_id: "bob"
)
```

```php label="PHP"
// read bob's timeline and include most recent reactions to all activities and their total count
$client-&gt;feed("timeline", "bob")-&gt;getActivities(0, 5, null, true, ["recent"=&gt;true, "counts"=&gt;true]);

// read bob's timeline and include most recent reactions to all activities and her own reactions by passing the user_id in the `options` array
$client-&gt;feed("timeline", "bob")-&gt;getActivities(0, 5, ["user_id" =&gt; "bob"], true, ["recent"=&gt;true, "counts"=&gt;true]);
```

```java label="Java"
// read bob's timeline and include most recent reactions to all activities and their total count
client.flatFeed("timeline", "bob")
    .getEnrichedActivities(new EnrichmentFlags()
        .withRecentReactions()
        .withReactionCounts()).get();

// read bob's timeline and include most recent reactions to all activities and her own reactions
client.flatFeed("timeline", "bob")
    .getEnrichedActivities(new EnrichmentFlags()
        .withOwnReactions()
        .withRecentReactions()
        .withReactionCounts()).get();
```

```go label="Go"
// read bob's timeline and include most recent reactions to all activities and their total count
	opts := []stream.GetActivitiesOption{
		stream.WithEnrichRecentReactions(),
		stream.WithEnrichReactionCounts(),
	}
	resp, err := feed.GetEnrichedActivities(context.TODO(), opts...)
	if err != nil {
		panic(err)
	}

	// read bob's timeline and include most recent reactions to all activities and his own reactions
	opts = []stream.GetActivitiesOption{
		stream.WithEnrichOwnReactions(),
		stream.WithEnrichRecentReactions(),
		stream.WithEnrichReactionCounts(),
	}
	resp, err := feed.GetEnrichedActivities(context.TODO(), opts...)
	if err != nil {
		panic(err)
	}

 // read bob's timeline and include reactions from john
 opts = []stream.GetActivitiesOption{
		stream.WithEnrichOwnReactions(),
		stream.WithEnrichUserReactions("john"),
	}
	resp, err := feed.GetEnrichedActivities(context.TODO(), opts...)
	if err != nil {
		panic(err)
	}
```

</Tabs>

## Notify Other Feeds

When adding a reaction, you can use the  `target_feeds`  parameter to notify a list of users about the new reaction. When specified, all targeted feeds will receive an activity containing a reference to the reaction.

<Tabs>

```csharp label="C#"
// adds a comment reaction to the activity and notifies Thierry's notification feed
var reactionData = new Dictionary<string, object="">()
{
  { "text", "@thierry great post!"},
};
var feedsToNotify = new[] { "notification:thierry" };
await client.Reactions.AddAsync("comment", activityId, "bob", reactionData, feedsToNotify);
```

```js label="JavaScript"
// adds a comment reaction to the activity and notifies Thierry's notification feed
client.reactions.add(
  "comment",
  activityId,
  { text: "@thierry great post!" },
  { targetFeeds: ["notification:thierry"] },
);

//adds a like reaction to the activity and notifies Thierry's notification feed
client.reactions.add(
  "like",
  activityId,
  {},
  { targetFeeds: ["notification:thierry"] },
);
```

```python label="Python"
# adds a comment reaction to the activity and notifies Thierry's notification feed
client.reactions.add(
  "comment",
  activity_id,
  user_id="mike",
  data={"text": "@thierry great post!"},
  target_feeds=["notification:thierry"],
)
```

```ruby label="Ruby"
# adds a comment reaction to the activity and notifies Thierry's notification feed
client.reactions.add(
  "comment",
  activity_id,
  "mike",
  data: {text: "@thierry great post!"},
  target_feeds: ["notification:thierry"],
)
```

```php label="PHP"
// adds a comment reaction to the activity and notifies Thierry's notification feed
$client-&gt;reactions()-&gt;add(
  "comment",
  $activity_id,
  "mike",
  ["text" =&gt; "@thierry great post!"],
  ["notification:thierry"],
);
```

```java label="Java"
Reaction comment = new Reaction.Builder()
    .kind("comment")
    .activityID(activity.getID())
    .extraField("text", "@thierry great post!")
    .build();

// adds a comment reaction to the activity and notifies Thierry's notification feed
client.reactions().add("john-doe", comment, new FeedID("notification:thierry")).join();
```

```go label="Go"
// adds a comment reaction to the activity and notifies Thierry's notification feed
	r := stream.AddReactionRequestObject{
		Kind:    "comment",
		ActivityID: activityID,
		UserID:   "bob",
		Data: map[string]any{
			"text": "@thierry great post!",
		},
		TargetFeeds: []string{"notification:thierry"},
	}
	resp, err := client.Reactions().Add(context.TODO(), r)
	if err != nil {
		panic(err)
	}
```

</Tabs>

<admonition type="info">

The `targetFeeds` field is limited to a maximum of 20 targets per API request.

</admonition>


---

This page was last updated at 2026-05-22T16:31:50.113Z.

For the most recent version of this documentation, visit [https://getstream.io/activity-feeds/docs/javascript/v2/reactions-read-feeds/](https://getstream.io/activity-feeds/docs/javascript/v2/reactions-read-feeds/).