Save Onboarding Baseline Tool¶
This workflow captures and stores essential business baseline information for youth entrepreneurs during their onboarding process. It accepts key business metrics like monthly fixed costs, business days per month, preferred contact times, and stock type, then safely updates the participant's record in the database.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
How It Works¶
- Receive Input Data: The workflow accepts six key pieces of information about a youth entrepreneur's business setup
- Update Database Record: Uses the phone number as a unique identifier to update the participant's baseline business information in the PostgreSQL database
- Format Response: Returns a structured response indicating whether the save operation was successful
The workflow uses a simple update operation that matches records by phone number and updates the baseline business metrics without affecting other participant data.
Workflow Diagram¶
graph TD
A[Trigger] --> B[updateBaseline]
B --> C[formatResponse]
D[upsertBaseline]
E[upsertBaseline1]
F[formatResponse1]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
Trigger¶
Execute Workflow Trigger - This workflow is designed to be called by other workflows or external systems. It expects the following input parameters:
phoneNumber- Participant's phone number (used as unique identifier)preferredTime- Preferred contact timemonthlyFixedCosts- Monthly fixed business costsbusinessDaysMonth- Number of business days per monthdailyFixedCost- Daily fixed cost calculationstockType- Type of stock/inventory management
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Execute Workflow Trigger | Trigger | Receives input parameters from calling workflow |
| PostgreSQL | updateBaseline | Updates participant record with baseline business data |
| Set | formatResponse | Formats the response with success status and message |
| PostgreSQL | upsertBaseline | (Unused) Alternative upsert implementation |
| PostgreSQL | upsertBaseline1 | (Unused) Alternative upsert with null handling |
| Set | formatResponse1 | (Unused) Alternative response formatter |
External Services & Credentials Required¶
PostgreSQL Database¶
- Credential Name: PostgresOnSupabase
- Purpose: Stores youth entrepreneur participant data
- Required Access: Read/Write access to
youthEntrepreneursRealtable - Connection: Supabase-hosted PostgreSQL instance
Environment Variables¶
No environment variables are directly used in this workflow. All configuration is handled through the PostgreSQL credential setup.
Data Flow¶
Input¶
1 2 3 4 5 6 7 8 | |
Output¶
1 2 3 4 | |
Database Impact¶
Updates the following fields in the youthEntrepreneursReal table:
- preferredTime
- monthlyFixedCosts
- businessDaysPerMonth
- dailyFixedCost
- stockType
Error Handling¶
The workflow includes basic error handling:
- Database Errors: The
updateBaselinenode continues execution even if errors occur - Success Validation: The response formatter checks if a phone number was returned to determine success
- Graceful Degradation: If the update fails, returns
success: falsewith an appropriate error message
Known Limitations¶
- The workflow contains several unused nodes (
upsertBaseline,upsertBaseline1,formatResponse1) that should be cleaned up - No input validation is performed on the received parameters
- Error details are not exposed in the response - only success/failure status
- The workflow assumes the participant record already exists (uses UPDATE, not INSERT)
Related Workflows¶
This workflow is designed to be called by other workflows in the youth entrepreneur onboarding system. Check for workflows that handle the initial onboarding flow or participant registration.
Setup Instructions¶
-
Import Workflow: Import the JSON into your n8n instance
-
Configure PostgreSQL Credential:
- Create a new PostgreSQL credential named "PostgresOnSupabase"
- Configure connection to your Supabase PostgreSQL instance
- Ensure the credential has read/write access to the
youthEntrepreneursRealtable
-
Verify Database Schema: Ensure your database has the
youthEntrepreneursRealtable with these columns:phoneNumber(TEXT, unique)preferredTime(TEXT)monthlyFixedCosts(NUMERIC)businessDaysPerMonth(INTEGER)dailyFixedCost(NUMERIC)stockType(TEXT)
-
Test the Workflow:
- Use the provided pin data to test the workflow
- Verify the database is updated correctly
- Check that the response format matches expectations
-
Clean Up (Optional):
- Remove unused nodes (
upsertBaseline,upsertBaseline1,formatResponse1) - This will simplify the workflow without affecting functionality
- Remove unused nodes (
-
Integration: Configure other workflows to call this one using the "Execute Workflow" node with the required input parameters