CEA Alert Tool Workflow¶
This workflow creates and manages CEA (Customer Engagement Alert) alerts by inserting alert records into a database and updating user engagement status. It serves as a centralized tool for triggering alerts with specific reasons, priorities, and profit snapshots while maintaining proper tracking in the user database.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
How It Works¶
- Receives Alert Data: The workflow is triggered by another workflow with alert details including phone number, reason, priority, summary, and profit snapshot
- Creates Alert Record: Inserts a new CEA alert into the
ceaAlertstable with status set to 'open' - Updates User Status: Flags the corresponding user record in
youthEntrepreneursRealtable with alert timestamp, reason, and engagement status - 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, not triggered directly. It expects the following input parameters:
- phoneNumber: Target user'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 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¶
- Credential Name: PostgresOnSupabase
- Purpose: Database operations for alert management and user tracking
- Required Permissions: INSERT and UPDATE access to
ceaAlertsandyouthEntrepreneursRealtables
Environment Variables¶
No environment variables are directly referenced in this workflow. All configuration is handled through the PostgreSQL credential.
Data Flow¶
Input Data¶
1 2 3 4 5 6 7 | |
Output Data¶
1 2 3 | |
Database Operations¶
- ceaAlerts Table: New record with auto-generated ID and timestamp
- youthEntrepreneursReal Table: Updated with alert timestamp, reason, and engagement status
Error Handling¶
This workflow does not implement explicit error handling. Database constraint violations or connection issues will cause the workflow to fail at the respective PostgreSQL nodes.
Known Limitations¶
- No input validation for required parameters
- No error handling for database failures
- Assumes
profitSnapshotcan be safely cast to JSONB - No rollback mechanism if user record update fails after alert creation
Related Workflows¶
This workflow is designed to be called by other workflows but no specific relationships are documented in the current context.
Setup Instructions¶
-
Import Workflow: Import the workflow JSON into your n8n instance
-
Configure PostgreSQL Credential:
- Create a PostgreSQL credential named "PostgresOnSupabase"
- Configure connection to your Supabase/PostgreSQL instance
- Ensure the credential has access to both
ceaAlertsandyouthEntrepreneursRealtables
-
Verify Database Schema:
- Ensure
ceaAlertstable exists with columns:phoneNumber,reason,priority,summary,profitSnapshot,status,id,createdAt - Ensure
youthEntrepreneursRealtable exists with columns:phoneNumber,ceaAlertTimestamp,ceaAlertReason,ceaEngagementStatus
- Ensure
-
Test the Workflow:
- Call this workflow from another workflow with sample data
- Verify alert record creation and user status update
- Check the output message format
-
Integration: Reference this workflow from other workflows using the Execute Workflow node with the required input parameters