Skip to content

Profit Path — Morning Prompt Seeder (Daily 08:00 EAT)

This workflow automatically prepares daily morning action prompts for youth entrepreneurs in the Profit Path program by seeding the database with scheduled follow-up records every day at 8:00 AM East Africa Time.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

Based on the workflow implementation, this appears to be part of a youth entrepreneurship coaching system that helps young business owners with profit-related challenges. The workflow ensures that eligible participants receive consistent daily motivation and action prompts to help them implement micro-actions that improve their business profitability.

How It Works

  1. Daily Trigger: Every day at 8:00 AM East Africa Time (5:00 AM UTC), the workflow automatically starts
  2. Database Preparation: The system first refreshes active follow-up records for all youth entrepreneurs whose primary challenge is profit-related
  3. Prompt Seeding: For each eligible participant, it creates a scheduled morning action prompt in the history table, but only if they haven't already received one today (preventing duplicates)

The workflow operates on two main database tables: - v4_profitpathFollowup: Tracks active participants and their assigned micro-actions - v4_profitpathHistory: Records scheduled prompts and their delivery status

Mermaid Diagram

graph TD
    A[Daily 08:00 EAT<br/>Schedule Trigger] --> B[Seed Morning Prompts<br/>PostgreSQL Query]

    B --> C[Update v4_profitpathFollowup<br/>Refresh active participants]
    B --> D[Insert into v4_profitpathHistory<br/>Create morning prompts]

Trigger

  • Type: Schedule Trigger (Cron)
  • Schedule: 0 5 * * * (5:00 AM UTC = 8:00 AM EAT)
  • Frequency: Daily
  • Timezone: Configured for East Africa Time operations

Nodes Used

Node Type Node Name Purpose
Schedule Trigger Daily 08:00 EAT Triggers the workflow daily at 8 AM EAT
PostgreSQL Seed Morning Prompts Executes database queries to prepare and seed morning prompts

External Services & Credentials Required

PostgreSQL Database

  • Credential Name: sifaV4Dev
  • Required Access: Read/Write permissions on:
    • v4_youthEntrepreneurs table
    • v4_profitpathFollowup table
    • v4_profitpathHistory table

Environment Variables

No environment variables are explicitly used in this workflow. All configuration is handled through: - Cron expression in the schedule trigger - Database connection via n8n credentials - Hardcoded timezone settings (Africa/Nairobi)

Data Flow

Input

  • Trigger: Time-based (no external data input)
  • Database State: Existing records in youth entrepreneurs and follow-up tables

Processing

  1. Identifies youth entrepreneurs with primary_pain_point = 'profit'
  2. Ensures they have assigned micro-actions
  3. Filters for active, non-paused participants
  4. Creates/updates follow-up records
  5. Seeds morning prompt history entries (idempotent per day)

Output

  • Updated v4_profitpathFollowup records with refreshed status
  • New v4_profitpathHistory entries for morning action prompts
  • Database changes only (no external API calls or file outputs)

Error Handling

This workflow uses basic PostgreSQL error handling: - UPSERT Operations: Uses ON CONFLICT DO UPDATE to handle existing records gracefully - Idempotent Design: The NOT EXISTS clause prevents duplicate daily prompts - NULL Safety: Uses COALESCE functions to handle missing data

No explicit error handling nodes are configured, so database errors would cause workflow failure and require manual intervention.

Known Limitations

  • Timezone Dependency: Hardcoded to Africa/Nairobi timezone
  • Single Database: No failover or backup database handling
  • No Notification: Workflow failures are not automatically reported
  • Manual Scaling: No automatic adjustment for participant volume changes

Based on the database structure, this workflow likely works in conjunction with: - Morning prompt delivery workflows (that read from v4_profitpathHistory) - Follow-up outcome processing workflows - Youth entrepreneur onboarding workflows

Setup Instructions

  1. Import Workflow

    • Import the JSON into your n8n instance
    • Ensure the workflow is initially inactive
  2. Configure Database Credentials

    • Create a PostgreSQL credential named sifaV4Dev
    • Ensure connection to database with required tables:
      • v4_youthEntrepreneurs
      • v4_profitpathFollowup
      • v4_profitpathHistory
  3. Verify Database Schema

    • Confirm all referenced columns exist in the tables
    • Test the SQL queries manually if needed
  4. Test Execution

    • Run the workflow manually first to verify database operations
    • Check that records are created/updated as expected
  5. Activate Workflow

    • Enable the workflow to start daily automatic execution
    • Monitor initial runs to ensure proper operation
  6. Timezone Considerations

    • Verify that 5:00 AM UTC corresponds to your desired local time
    • Adjust cron expression if different timezone needed