Business Summary Generator for Youth Entrepreneurs¶
This workflow automatically generates comprehensive business summaries for youth entrepreneurs by analyzing their chat history, business data, and performance metrics. It creates detailed reports for program managers to quickly understand each youth's business progress, engagement level, and areas needing attention.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
Based on the workflow implementation, this appears to serve youth entrepreneurship programs by: - Who it serves: Program managers and field coordinators overseeing youth entrepreneurs - What it achieves: Automated business performance analysis and reporting - Key value: Transforms raw data (chat logs, sales records) into actionable insights for program management - Use case: Regular monitoring of youth business progress without manual analysis
How It Works¶
- Input Validation: Receives a phone number and validates it exists and is not empty
- Youth Data Retrieval: Looks up the youth entrepreneur's profile information from the database
- Chat History Collection: Gathers the last 30 chat messages between the youth and AI business assistant
- Business Data Extraction: Retrieves recent business performance data including sales, costs, and profits
- Data Aggregation: Combines chat history and business metrics into structured datasets
- AI Analysis: Uses GPT-5.2 to analyze all data and generate a comprehensive business summary
- Summary Validation: Checks that the AI generated a valid response
- Database Update: Saves the generated summary back to the youth's profile for future reference
Workflow Diagram¶
graph TD
A[When Executed by Another Workflow] --> B[If: Phone Number Valid?]
B -->|Yes| C[get_chat_history]
B -->|No| D[No Operation, do nothing]
C --> E[get_youth_data]
E --> F[If1: Youth Found?]
F -->|Yes| G[set_yout_data]
F -->|No| D
G --> H[get_chat_history1]
H --> I[aggregate_chat_history]
I --> J[get_business_data]
J --> K[aggregate_business_data]
K --> L[generate_Summary]
M[OpenRouter Chat Model] --> L
L --> N[If2: Summary Generated?]
N -->|Yes| O[summary]
N -->|No| D
O --> P[add_business_summary]
Trigger¶
Execute Workflow Trigger: This workflow is designed to be called by other workflows, not run independently. It expects a phoneNumber parameter as input.
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Execute Workflow Trigger | When Executed by Another Workflow | Receives phone number input from calling workflow |
| If | If, If1, If2 | Validates input data and AI response at multiple stages |
| No Operation | get_chat_history, No Operation do nothing | Placeholder and error handling endpoints |
| Postgres | get_youth_data, get_chat_history1, get_business_data, add_business_summary | Database operations for reading youth profiles, chat logs, business data, and saving summaries |
| Set | set_yout_data, summary | Data transformation and variable assignment |
| Aggregate | aggregate_chat_history, aggregate_business_data | Combines multiple database records into structured arrays |
| Chain LLM | generate_Summary | AI-powered analysis using detailed prompt for business summary generation |
| OpenRouter Chat Model | OpenRouter Chat Model | GPT-5.2 language model connection |
External Services & Credentials Required¶
Database Connection¶
- Service: PostgreSQL (Supabase)
- Credential:
PostgresOnSupabase - Tables Used:
youthEntrepreneursReal- Youth profiles and business summariesn8n_chat_histories- Chat conversation logsdailyProfitTracking- Business performance metrics
AI Service¶
- Service: OpenRouter API
- Credential:
OpenRouter account - Model:
openai/gpt-5.2 - Usage: Business analysis and summary generation
Environment Variables¶
No environment variables are explicitly configured in this workflow. All external connections use stored credentials.
Data Flow¶
Input¶
phoneNumber(string): Youth entrepreneur's phone number identifier
Processing Data¶
- Youth profile data (name, ward, business type, existing summary)
- Chat history (last 30 messages with timestamps)
- Business data (sales, costs, profits, micro-actions)
- Current date for temporal context
Output¶
- Comprehensive business summary (300+ words) stored in database
- Includes: performance analysis, engagement assessment, timeline of events, health assessment, and manager recommendations
Error Handling¶
The workflow includes multiple validation checkpoints:
- Input Validation: If phone number is missing or empty, workflow terminates gracefully
- Youth Lookup: If no youth found with provided phone number, workflow stops
- AI Response Validation: If summary generation fails or returns empty, workflow terminates
- Database Error Handling: Youth data retrieval has
continueRegularOutputenabled to handle missing records
All error paths lead to the "No Operation, do nothing" node for clean termination.
Known Limitations¶
- Limited to last 30 chat messages and business records
- Requires existing youth profile in database
- Dependent on OpenRouter API availability
- Summary quality depends on data completeness
- No retry mechanism for failed AI generation
Related Workflows¶
This workflow is designed to be called by other workflows in the youth entrepreneurship program ecosystem. Based on the naming pattern, it likely integrates with: - Main youth monitoring workflows - Scheduled reporting systems - Manager dashboard workflows
Setup Instructions¶
- Import Workflow: Import the JSON into your n8n instance
- Configure Database Credential:
- Create PostgreSQL credential named
PostgresOnSupabase - Configure connection to your Supabase/PostgreSQL instance
- Ensure access to required tables:
youthEntrepreneursReal,n8n_chat_histories,dailyProfitTracking
- Create PostgreSQL credential named
- Configure AI Credential:
- Create OpenRouter credential named
OpenRouter account - Add your OpenRouter API key
- Verify access to
openai/gpt-5.2model
- Create OpenRouter credential named
- Database Schema: Ensure the
business_summarycolumn exists inyouthEntrepreneursRealtable - Test Execution: Call workflow with a valid phone number to verify all connections work
- Integration: Connect this workflow to your main youth monitoring or reporting workflows
Note: This workflow requires an existing youth entrepreneurship database structure and should be integrated into a larger program management system.