Skip to content

CEA Alert Tool - Francis

This workflow creates and manages CEA (Customer Engagement Alert) alerts by inserting alert records into the database and updating user engagement status. It serves as a centralized tool for triggering alerts when specific conditions or events require immediate attention from customer engagement teams.

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 details including phone number, reason, priority, summary, and profit snapshot
  2. Creates Alert Record: Inserts a new alert into the ceaAlerts database table with status set to 'open'
  3. Updates User Status: Flags the corresponding user record in youthEntrepreneursReal table with alert timestamp, reason, and engagement status
  4. Returns Confirmation: Outputs a formatted message confirming the alert creation with relevant 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 expects the following input parameters: - phoneNumber - Target user's phone number - reason - Reason for the alert - priority - Alert priority level - summary - Brief description of the alert - 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 alert record in ceaAlerts table
flagUserRecord PostgreSQL Updates user record with alert information
setOutput Set Formats and returns confirmation message

External Services & Credentials Required

  • PostgreSQL Database: Requires "PostgresOnSupabase" credential for database operations
    • Database must contain ceaAlerts and youthEntrepreneursReal tables
    • Required permissions: INSERT, UPDATE

Environment Variables

No environment variables are used in this workflow.

Data Flow

Input

1
2
3
4
5
6
7
{
  "phoneNumber": "string",
  "reason": "string", 
  "priority": "string",
  "summary": "string",
  "profitSnapshot": "object (optional)"
}

Output

1
2
3
{
  "output": "CEA alert created (ID: {alertId}) for {phoneNumber}. Reason: {reason}. Priority: {priority}."
}

Error Handling

This workflow does not implement explicit error handling. Database errors or connection issues will cause the workflow to fail. Consider adding error handling nodes for production use.

Known Limitations

  • No validation of input parameters
  • No error handling for database failures
  • Workflow status is currently inactive
  • No notification system for created alerts
  • Profit snapshot data is stored as-is without validation

No related workflows identified from the current context.

Setup Instructions

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

  2. Configure Database Credential:

    • Create a PostgreSQL credential named "PostgresOnSupabase"
    • Configure connection to your Supabase/PostgreSQL instance
    • Ensure the credential has INSERT and UPDATE permissions
  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 the Workflow:

    • Call from another workflow with required parameters
    • Verify alert creation in database
    • Check user record updates
  5. Activate: Set the workflow to active status when ready for production use

  6. Integration: Configure calling workflows to use this workflow for CEA alert creation