Skip to content

bug: Tapping Omi response notifications doesn't navigate to the correct conversation #5126

Closed

Description

@mdmohsin7

Bug Report

User-Reported Behavior

  • On iOS: tapping an Omi notification opens the app but navigates to the last chat instead of the specific conversation
  • On macOS beta: tapping a notification only shows the most recent notification, not the full notification history

Root Cause

The Flutter app is missing two critical FCM notification tap handlers:

1. FirebaseMessaging.onMessageOpenedApp — not registered (Background state)

When the app is in the background and a user taps an FCM push notification, Firebase fires FirebaseMessaging.onMessageOpenedApp. The message's data payload includes navigate_to (e.g. /chat/omi), but there is no listener registered for this event anywhere in the codebase.

File: app/lib/services/notifications/notification_service_fcm.dart
Method: listenForMessages() — only handles FirebaseMessaging.onMessage (foreground), not onMessageOpenedApp (background tap)

2. FirebaseMessaging.instance.getInitialMessage() — not called (Terminated state)

When the app is terminated and a user taps a notification to open it, getInitialMessage() should be called at startup to retrieve the triggering message and navigate accordingly. This is also absent.

3. iOS foreground notifications not shown for plugin type

In _shouldShowForegroundNotificationOnFCMMessageReceived(), only Android shows foreground notifications (return Platform.isAndroid). On iOS, plugin/chat notifications received while the app is in the foreground are silently dropped into a stream without triggering a visible notification or navigation.

Data Flow (for context)

Backend sends FCM via send_notification() with a full data payload:

# backend/utils/chat.py
ai_message = NotificationMessage(
    notification_type='plugin',
    navigate_to=f'/chat/{app_id}',  # or '/chat/omi' for main
    ...
)
send_notification(user_id, app_name + ' says', message, NotificationMessage.get_message_as_dict(ai_message))

The navigate_to field is present in the FCM payload — the app just never reads it on notification tap from background/terminated state.

Fix Required

In notification_service_fcm.dart, add to listenForMessages():

// Background: app in background, user taps notification
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
  final navigateTo = message.data['navigate_to'];
  if (navigateTo != null && navigateTo.isNotEmpty) {
    NotificationUtil.handleDeepLink({'navigate_to': navigateTo});
  }
});

// Terminated: app was closed, user taps notification to open
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? message) {
  if (message != null) {
    final navigateTo = message.data['navigate_to'];
    if (navigateTo != null && navigateTo.isNotEmpty) {
      NotificationUtil.handleDeepLink({'navigate_to': navigateTo});
    }
  }
});

Also expose _handleAppLinkOrDeepLink as a public static method on NotificationUtil.

Affected Platforms

  • iOS (primary)
  • macOS beta
  • Potentially Android (though foreground notification display works there)

Affected Notification Types

  • Omi AI response notifications (notification_type: 'plugin')
  • App plugin chat notifications

References

  • app/lib/services/notifications/notification_service_fcm.dart — listenForMessages()
  • app/lib/services/notifications.dart — _handleAppLinkOrDeepLink()
  • backend/utils/chat.py — send_chat_message_notification()
  • backend/utils/app_integrations.py — send_app_notification()

Activity

  1. added
    bug
    on Feb 25, 2026
  2. added a commit that references this issue on Feb 25, 2026
    19bca3e
  3. hugoaap-code commented on Feb 25, 2026

    @hugoaap-code

    yes Android presents same behaviour

  4. added
    p2
    ux-polish
    maintainer
    on Feb 26, 2026
  5. aaravgarg commented on Mar 11, 2026

    @aaravgarg
    Contributor

    @mdmohsin7 please close within this week mar 13

  6. aaravgarg commented on Apr 20, 2026

    @aaravgarg
    Contributor
  7. aryanorastar commented on Aug 5, 2026

    @aryanorastar
    Collaborator

    Opened a fix that resurrects closed unmerged #5127 with Gemini’s type-safe navigate_to parsing applied:

    • FirebaseMessaging.onMessageOpenedApp (background tap)
    • getInitialMessage() (terminated tap)
    • NotificationUtil.handleNavigateTo + unit-tested navigateToFromFcmData

    PR: will link after create.

  8. aryanorastar commented on Aug 5, 2026

    @aryanorastar
    Collaborator

    Opened #11144 — resurrects closed unmerged #5127 with Gemini’s type-safe navigate_to parsing:

    • FirebaseMessaging.onMessageOpenedApp (background tap)
    • getInitialMessage() (terminated tap)
    • NotificationUtil.handleNavigateTo + unit-tested navigateToFromFcmData
  9. moved this from In progress to In review in omi TODO / bountieson Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugmaintainerp2ux-polish

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions