Skip to content

V4 - MorningNudgeCron - Warenga

This workflow sends daily morning nudges to active youth entrepreneurs at 10:00 AM East Africa Time, checking in on their emotional state and reminding them about their current micro-actions to help maintain engagement and momentum in their entrepreneurial journey.

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 sends personalized daily check-ins to participants, helping them stay accountable to their micro-actions and providing emotional support.

How It Works

  1. Daily Trigger: Every day at 10:00 AM EAT (07:00 UTC), the workflow automatically starts
  2. Bridge Onboarding Data: Ensures new users have their first micro-action properly recorded in the tracking system
  3. Query Active Youth: Retrieves all active, non-paused youth entrepreneurs along with their current micro-actions
  4. Validate Results: Checks if any youth were found to process
  5. Process Each Youth: Loops through each youth individually to create personalized messages
  6. Compose Messages: Creates contextual morning messages that either reference their current micro-action or provide general encouragement
  7. Send Nudges: Calls an external workflow to deliver the messages via their preferred channel (WhatsApp, etc.)

Workflow Diagram

graph TD
    A["10AM EAT (07:00 UTC)"] --> B["Bridge Onboarding"]
    B --> C["Get Active Youth"]
    C --> D["Has Youth?"]
    D -->|Yes| E["Loop Over Youth"]
    E --> F["Compose Morning Msg"]
    F --> G["Call NudgeSender"]
    G --> E
    E -->|Complete| H[End]
    D -->|No| H[End]

Trigger

  • Type: Schedule Trigger
  • Frequency: Daily at 07:00 UTC (10:00 AM East Africa Time)
  • Status: Currently inactive

Nodes Used

Node Type Node Name Purpose
Schedule Trigger 10AM EAT (07:00 UTC) Triggers workflow daily at specified time
Postgres Bridge Onboarding Migrates onboarding data to micro-action history table
Postgres Get Active Youth Queries active youth and their current micro-actions
If Has Youth? Validates that youth data was retrieved
Split in Batches Loop Over Youth Processes each youth individually
Code Compose Morning Msg Creates personalized morning messages
Execute Workflow Call NudgeSender Sends messages via external workflow

External Services & Credentials Required

Database

  • Service: PostgreSQL
  • Credential: sifaV4Dev
  • Purpose: Stores youth entrepreneur data and micro-action history

External Workflows

  • NudgeSender Workflow: SRUua3GiNudDV1XK
  • Purpose: Handles message delivery across different channels

Environment Variables

No environment variables are explicitly used in this workflow. All configuration is handled through: - Database credentials - Workflow references - Hardcoded schedule timing

Data Flow

Input

  • Trigger: Time-based (no external input data)

Processing

  • Queries youth entrepreneurs with status active and is_emotionally_paused = false
  • Retrieves current micro-actions from history table
  • Creates personalized messages based on available data

Output

  • Sends structured message data to NudgeSender workflow containing:
    • phoneNumber: Recipient's phone number
    • message: Personalized morning nudge text
    • nudge_step: Fixed value "D1.1"
    • channel: Communication channel (default: whatsapp)
    • nudge_type: Fixed value "daily_morning"
    • firstName: Youth's first name

Error Handling

The workflow includes basic error handling: - Data Validation: Checks if youth data exists before processing - Null Safety: Handles missing first names (defaults to 'rafiki') and channels (defaults to 'whatsapp') - Idempotent Operations: Bridge operation only inserts new records, avoiding duplicates

No explicit error recovery or notification mechanisms are implemented.

Known Limitations

  • Workflow is currently inactive and needs to be enabled
  • No retry mechanism for failed message sends
  • Limited error reporting and monitoring
  • Hardcoded timing may not account for daylight saving changes
  • Single database dependency creates potential single point of failure
  • NudgeSender (SRUua3GiNudDV1XK): Handles actual message delivery

Setup Instructions

  1. Import Workflow

    • Import the workflow JSON into your n8n instance
    • Ensure it's placed in the "Sifa V4" project
  2. Configure Database Credentials

    • Set up PostgreSQL credential named sifaV4Dev
    • Ensure access to tables: v4_youthEntrepreneurs, v4_microaction_history
  3. Verify Dependencies

    • Confirm NudgeSender workflow (SRUua3GiNudDV1XK) exists and is functional
    • Test database connectivity and query permissions
  4. Database Schema Requirements

    • v4_youthEntrepreneurs table with columns: phoneNumber, firstName, channel, businessOwned, onboardingStatus, is_emotionally_paused, first_micro_action
    • v4_microaction_history table with columns: phonenumber, micro_action, micro_action_type, source, status
  5. Activate Workflow

    • Enable the workflow to start daily execution
    • Monitor initial runs to ensure proper functionality
  6. Testing

    • Test with a small subset of data first
    • Verify message delivery through the NudgeSender workflow
    • Confirm database updates are working correctly