Project

General

Profile

Edit Copy Actions

Feature #7133

open

Working on Des Features

Added by Thirupathirao Uppu 2 days ago. Updated about 19 hours ago.

Status:
New
Priority:
Normal
Start date:
01/27/2026
Due date:
% Done:

30%

Estimated time:
40:00 h
Spent time:

Description

To integrate the notification system and align it with AI-driven capabilities, here is the strategic backend roadmap for the Travelmate project.
Based on my analysis of your NestJS backend (
travelmate-app-be), most of the basic triggers are already implemented, but they need broadcasting logic and AI optimization to become a "smart" system.

Phase 1: Core Integration & Broadcasting (The "Link" Phase)
The current backend has individual notifications, but lacks a "broadcast" mechanism for ride-wide status changes.
  • 1.1 Broad Status Updates: * Logic: Modify 

updateRideStatus in 

rides.service.ts. * Trigger: When a ride is Cancelled or Completed by the driver. * Action: Iterate through all Confirmed and Boarded bookings for that rideId and send a batch notification using Promise.allSettled.
  • 1.2 Consistent Payload Schema: * Ensure every notification (FCM) follows the structure expected by the React Native app (e.g., type: 'ride_request' for loud alerts, or type: 'status_update').
  • 1.3 Reliable Delivery (Queueing): * Introduce BullMQ or Redis. Notifications should be processed as background jobs so that the API response isn't slowed down by Firebase latency.
Phase 2: Behavioral AI Integration (Smart Notifications)
This is where the "Roadmap AI" comes in to make the app feel premium and intelligent.
  • 2.1 Predictive Delay Alerts (AI Model): * Scenario: If the driver is 5km away and the ride starts in 10 minutes, AI predicts a "High Probability of Delay". * Backend Task: Run a cron job that compares driverLocation vs pickupPoint. If the delay probability > 80%, send an automated "Driver is running late" notification to the passenger.
  • 2.2 Fraud & Safety Monitoring (Anomaly Detection): * Scenario: A ride is marked Ongoing, but GPS hasn't moved for 15 minutes. * Backend Task: AI detects this anomaly and triggers a "Safety Check" notification to the passenger asking if they are okay.
  • 2.3 Smart Frequency Capping: * AI analyzes user engagement. If a user ignores 5 notifications in a row, the backend switches to SMS-only for critical alerts or slows down promotional push notifications to avoid being marked as spam.
Phase 3: Advanced Communication (SMS & Multichannel)
Ensuring the user is reached even if they are offline.
  • 3.1 Twilio/SMS Fallback: * Integrate the twilio module (already present in your code) into the 

NotificationsService. * Logic: If firebaseService.sendPush fails or the user is offline, automatically trigger an SMS for critical OTPs or Ride Start alerts.
  • 3.2 AI-Generated Notifications: * Use an LLM (OpenAI/Gemini) to generate personalized ride summaries or "Weekly Impact" reports (e.g., "You saved 50kg of CO2 this week! Check your history.").
Phase 4: Observability & ROI
  • Notification Analytics: Track "Open Rates" for notifications to see which triggers (e.g., "Ride Started") get the fastest response.
  • In-App Inbox Sync: Ensure the notification.schema.ts always reflects the true state, so if a user opens a push, the in-app notification is marked as isRead: true automatically.
    Recommended Task Hierarchy for Developers:
    1. Immediate: Fix 

updateRideStatus to notify multiple passengers at once.
    2. Short Term: Centralize all FCM calls into notificationsService.notify to remove code duplication in 

rides.service.ts.
    3. Medium Term: Add a background worker for notification retries.
    4. Long Term: Implement the AI delay prediction model using driver GPS history.

Add

Subtasks


Add

Related issues

Edit Copy Actions

Also available in: Atom PDF