Skip to content

[Feature] Implement email and in-app notifications for pool events #68

Description

@grantfox-oss

Getting Started

  1. Fork the repository: https://github.com/JointSave-org/Joint_Save
  2. Clone your fork:
   git clone https://github.com/<your-username>/Joint_Save.git
   cd Joint_Save
  1. Create a new branch:
   git checkout -b feat/pool-event-notifications

Overview

Users currently have no way to know when it's their turn to deposit, when a payout was triggered, or when a group reaches its target — unless they actively check the app. No Supabase Edge Function or any notification-related code exists in the repo yet.

Requirements

Supabase Edge Function: notify-pool-event

Create supabase/functions/notify-pool-event/index.ts:

  • Triggered by a database webhook on pool_activity INSERT
  • Based on activity_type:
    • payout: Email the beneficiary "You received X XLM from [pool name]"
    • deposit: Email all other members "[Member] deposited to [pool name]"
    • round_advance: Email all members "Round N complete. [Next member] is the next beneficiary."
    • target_reached: Email all members "[Pool name] reached its target! You can now withdraw."
  • Use Resend or SendGrid for email delivery (configurable via env var)

User Preferences

  • Add a notification_preferences JSONB column to a user_profiles table in Supabase:
  { "email_on_payout": true, "email_on_deposit": false, "email_on_round": true }
  • Add a "Notifications" section in profile.tsx with toggle switches for each preference

Frontend

  • Show an in-app notification bell icon in dashboard-header.tsx
  • Unread count badge on the bell
  • Dropdown showing the last 10 activity events across all of the user's pools

Acceptance Criteria

  • Edge function deployed and triggered on pool_activity INSERT
  • Email sent to the correct recipient based on event type
  • User preferences respected (opt-out works)
  • In-app notification bell shows unread count
  • Notification preference toggles save correctly to Supabase

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSOfficial CampaignCampaign: Official CampaignfeatureNew functionality to addmedium-complexityNot too complex, Few files and some planning needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions