Skip to content

triggerCeaAlertTool - Francis

This workflow creates CEA (Customer Engagement Alert) records in a database when triggered by other workflows. It logs alert details, updates user engagement status, and provides confirmation output for monitoring and tracking purposes.

Purpose

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

How It Works

  1. Receives Alert Data: The workflow is triggered by another workflow with alert parameters including phone number, reason, priority, summary, and profit snapshot
  2. Creates Alert Record: Inserts a new CEA alert into the database with all provided details and sets status to 'open'
  3. Updates User Status: Flags the corresponding user record with alert timestamp, reason, and engagement status
  4. Returns Confirmation: Provides a formatted output message confirming the alert creation with key details

Workflow Diagram

graph TD
    A[When Executed by Another Workflow] --> B[insertCeaAlert]
    B --> C[flagUserRecord]
    C --> D[setOutput]

Trigger

Execute Workflow Trigger: This workflow is designed to be called by other workflows. It accepts the following input parameters: - phoneNumber - Customer's phone number - reason - Reason for the alert - priority - Alert priority level - summary - Alert summary description - profitSnapshot - JSON data containing profit information

Nodes Used

Node Name Type Purpose
When Executed by Another Workflow Execute Workflow Trigger Receives input parameters from calling workflow
insertCeaAlert PostgreSQL Creates new CEA alert record in database
flagUserRecord PostgreSQL Updates user engagement status and alert metadata
setOutput Set Formats confirmation message with alert details

External Services & Credentials Required

  • PostgreSQL Database: Requires connection to Supabase PostgreSQL instance
    • Credential: PostgresOnSupabase (ID: Hw9XWerQ5RNHaVTk)
    • Tables accessed: ceaAlerts, youthEntrepreneursReal

Environment Variables

No environment variables are explicitly used in this workflow. Database connection details are managed through n8n credentials.

Data Flow

Input Parameters: - phoneNumber (string) - Customer identifier - reason (string) - Alert reason - priority (string) - Alert priority - summary (string) - Alert description - profitSnapshot (JSON) - Profit data snapshot

Database Operations: - Inserts new record in ceaAlerts table with status 'open' - Updates youthEntrepreneursReal table with alert timestamp and engagement status

Output: - Formatted confirmation message containing alert ID, phone number, reason, and priority

Error Handling

This workflow does not implement explicit error handling. Database operation failures will cause the workflow to stop and return error details from the PostgreSQL nodes.

Known Limitations

No specific limitations documented in the business context.

No related workflows specified in the current context.

Setup Instructions

  1. Import Workflow: Import the workflow JSON into your n8n instance

  2. Configure Database Credentials:

    • Create or verify PostgreSQL credential named "PostgresOnSupabase"
    • Ensure connection to Supabase database with required tables
  3. Verify Database Schema:

    • Ensure ceaAlerts table exists with columns: phoneNumber, reason, priority, summary, profitSnapshot, status, id, createdAt
    • Ensure youthEntrepreneursReal table exists with columns: phoneNumber, ceaAlertTimestamp, ceaAlertReason, ceaEngagementStatus
  4. Test Execution:

    • Call this workflow from another workflow with sample data
    • Verify alert record creation and user status updates
    • Check output message format
  5. Integration:

    • Configure calling workflows to pass required parameters
    • Ensure proper error handling in parent workflows