Objective
- When an inspector is @ mentioned in the activity feed of an inspection, send a push notification to their mobile device so they see it even when the app is closed or in the background.
- Keep existing behavior: in-app notifications and email for mentions stay as-is; push is an additional channel for mobile.
Background
- Today, @ mentions in the activity feed create in-app notifications (stored in the backend and shown in the web app) and can trigger email via
sendEmailNotification. There is no push path to mobile devices. - Inspectors using the mobile app need to be notified on their device when someone mentions them so they can respond without having to open the app or check email.
- The activity feed lives on the inspection workorder; notes (and their mentions) are created via the notes API and rendered in
ActivityFeed/InspectionActivityFeed.
Scope
- Backend (attik-backend)
Mention notifications are created insrc/util/notifications/notificationService.ts:createMentionNotificationsbuilds in-DB notifications and callscreateNotification, which also triggerssendEmailNotificationinsrc/util/notifications/emailNotificationService.ts. Notes (and thus mentions) are created insrc/routes/notes.ts, which callscreateMentionNotificationsafter a note is saved (around lines 206–214). Notifications are stored per the model insrc/models/notificationSchema.tsand exposed viasrc/routes/notifications.ts(list, count, mark read, delete). There is no existing push infrastructure (no FCM, APNs, or Expo Push in this repo). In scope: deciding how to deliver push for mention notifications (e.g. device token storage, who sends push—backend vs separate service—and how it is triggered from the existingcreateNotification/createMentionNotificationsflow). No prescriptive implementation; the developer should align with how the mobile app registers for and receives push. - Frontend (attik-frontend)
The activity feed and mention UI are insrc/components/activityFeed/ActivityFeed.tsx,src/app/tools/inspections/[id]/components/InspectionActivityFeed.tsx, and mention parsing insrc/util/functions/data/parseContentWithMentions. The dashboard "Recent mentions" experience is insrc/components/dashboard/RecentMentions/MentionsList.tsx, which opens/inspections/${notification.inspection._id}?tab=activity-feed. No change is required here for "when" mentions fire; optional: ensure any deep link or URL used in the push payload (e.g. to open the inspection's activity feed) matches this pattern if the mobile app uses it. - Mobile (attik-mobile)
The app lives in the workspace under attik-mobile (app root:attik-mobile/attik-mobile). It is an Expo app (Expo ~54); expo-notifications is not inpackage.json, so push registration and handling are not yet implemented. The app already supports mention notes in-app: notes that mention the user are fetched inhooks/useInspectionNotes.ts(note API withwithMentions: 'true'andinspectorId), displayed incomponents/inspection/NotesSection.tsxin a "Mentioned" section with unread styling, and the associated in-app notification is marked read via the backendnotification/:id/readendpoint when the user views the note. Types forNoteMentionandNote.notificationare intypes/index.ts; mention parsing for display is inlib/parseContentWithMentions.tsx. The inspection detail screen isapp/inspection/[id].tsx(with notes in a tab/section); the URL scheme inapp.config.jsis attikmobile, which can be used for deep links in the push payload (e.g. open/inspection/{inspectionId}or the notes section). In scope: adding push support—register device tokens with the backend or push provider, handle incoming push when the user is @ mentioned, and optionally deep link to the inspection (or inspection notes). Decisions about token registration, payload shape, and deep link path are left to the developer; the existing mention/notification UI and API usage inNotesSection.tsxanduseInspectionNotes.tsare the in-app target once the user opens the app from push.
References
- Backend mention notification flow:
attik-backend/src/util/notifications/notificationService.ts(createMentionNotifications,createNotification) - Where mentions are triggered:
attik-backend/src/routes/notes.ts(note creation and call tocreateMentionNotifications) - Notification model:
attik-backend/src/models/notificationSchema.ts - Mobile mention/notes UI:
attik-mobile/hooks/useInspectionNotes.ts,attik-mobile/components/inspection/NotesSection.tsx,attik-mobile/lib/parseContentWithMentions.tsx; inspection detail:attik-mobile/app/inspection/[id].tsx; app scheme:attik-mobile/app.config.js(schemeattikmobile) - Firebase Cloud Messaging (FCM) (Android and cross-platform)
- Apple Push Notification service (APNs)
- Expo Push Notifications (Expo app; use with EAS and backend token storage)