# User Mentions

## Overview

You can mention users in both **activities** and **comments**. When you include `mentioned_user_ids`, the API stores the mentions and returns enriched `mentioned_users` in the response. Optionally, you can create [notification activities](https://getstream.io/activity-feeds/docs/flutter/notification-feeds/) for mentioned users or [send push notifications](https://getstream.io/activity-feeds/docs/flutter/push-introduction/).

## Adding user mentions

`mentioned_user_ids` can only contain existing user ids, you can use [`queryUsers` endpoint](https://getstream.io/activity-feeds/docs/flutter/user-management/#filter-examples) to search for users to mention.

Please note that it's up to you to include user mentions (for example @Alice) in the activity/comment text, the Stream API won't modify these fields based on `mentioned_user_ids`.

### Adding an activity with mentions

```dart label="Dart"
final activity = await feed.addActivity(
  request: FeedAddActivityRequest(
    text: 'Hey @bob and @alice, check this out!',
    type: 'post',
    mentionedUserIds: ['bob', 'alice'],
    createNotificationActivity: true,
  ),
);
// activity.mentionedUsers contains enriched user objects
```

### Adding a comment with mentions

```dart label="Dart"
final comment = await feed.addComment(
  request: ActivityAddCommentRequest(
    comment: 'Thanks @bob for the tip!',
    activityId: 'activity_123',
    activityType: 'activity',
    mentionedUserIds: ['bob'],
    createNotificationActivity: true,
  ),
);
// comment.mentionedUsers contains enriched user objects
```

## Reading mentioned users

Activities and comments returned by the API include a `mentioned_users` array with enriched user objects (id, name, image, etc.). Use them to render @mentions in your UI.

```dart label="Dart"
// From activities
await feed.getOrCreate();
for (final activity in feed.state.activities) {
  if (activity.mentionedUsers != null && activity.mentionedUsers!.isNotEmpty) {
    print('Mentioned: ${activity.mentionedUsers!.map((u) => u.name).join(', ')}');
  }
}
// From comments
final activity = await feed.getActivity(activityId, withRecentReplies: 10);
for (final comment in activity.latestReplies ?? []) {
  if (comment.mentionedUsers != null && comment.mentionedUsers!.isNotEmpty) {
    print('Comment mentioned: ${comment.mentionedUsers!.map((u) => u.name).join(', ')}');
  }
}
```

## Mentions in notification feed

- **Activities:** When `create_notification_activity` is `true`, each mentioned user receives a `mention` notification in their notification feed.
- **Comments:** When `create_notification_activity` is `true`, each mentioned user receives a `comment_mention` notification (the activity author does not get an extra notification for mentions; they already get a comment notification).

For updating or deleting activities/comments and managing mention notifications (e.g. `handle_mention_notifications`, `delete_notification_activity`), see [Notification feeds](https://getstream.io/activity-feeds/docs/flutter/notification-feeds/).

## Push notifications

Use the `skip_push` parameter to control if push notifications are sent to mentioned users or not. For more information check the [Push notification guide](https://getstream.io/activity-feeds/docs/flutter/push-introduction/) that contains all relevant information about setting up push notification providers, customizing notifications and user preferences.


---

This page was last updated at 2026-08-07T20:37:30.022Z.

For the most recent version of this documentation, visit [https://getstream.io/activity-feeds/docs/flutter/user-mentions/](https://getstream.io/activity-feeds/docs/flutter/user-mentions/).