WaspW
Wasp2y ago
OrBlatt

Scheduling email sending with Pg-boss

Project Overview


I have developed a feature that allows sending a list of tasks via email to the logged-in user using Mailgun. I now want to enhance this functionality by implementing a subscription service for users to receive a digest of new tasks based on a search profile.

Key Requirements


  1. **Subscription Feature**:
    • Users can subscribe to a search profile.
    • Each search profile will have criteria such as minPrice and maxPrice to filter tasks.
  2. **Email Digest**:
    • A digest of new tasks meeting the search profile criteria will be sent via email.
    • Users can choose the frequency of the email: daily or weekly.
  3. **Scheduling with pg-boss**:
    • Use pg-boss for scheduling the email dispatch.
    • The scheduling should support both daily (cron string: 0 0 * * *) and weekly (cron string: 0 0 * * 5) options based on user preference.
## Assistance Needed

I need assistance with the following:

  1. **Implementation of the Subscription Logic**:
    • How to allow users to create and manage their search profiles.
    • Storing user preferences for email frequency.
  2. **Integration with pg-boss**:
    • Setting up pg-boss to handle the scheduling based on user preferences.
    • Ensuring the correct cron string is used for each user’s chosen frequency.
  3. **Email Sending**:
    • Filtering tasks based on the search profile criteria (minPrice and maxPrice).
    • Formatting the tasks into a digest and sending the email using Mailgun.
## Request

Kapa.ai Could you provide a detailed implementation plan or example code snippets to achieve this?
Was this page helpful?