getSummary - Francis¶
This workflow extracts phone numbers from text queries and retrieves business summaries for youth entrepreneurs from a PostgreSQL database. It uses AI-powered information extraction to identify valid phone numbers, then looks up corresponding business information in the youthEntrepreneursReal table.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
How It Works¶
- Receives Input: The workflow is triggered by another workflow with a text query containing potential phone number information
- Extracts Phone Number: Uses an AI language model to intelligently extract phone numbers from the input text, looking for strings of 8 or more digits
- Validates Phone Number: Checks if a valid phone number was found (not equal to "0")
- Database Lookup: If a valid phone number exists, queries the PostgreSQL database to find matching records in the youthEntrepreneursReal table
- Returns Business Summary: Extracts and returns the business_summary field from the database results
- Handles No Match: If no valid phone number is found, the workflow does nothing and exits gracefully
Workflow Diagram¶
graph TD
A[When Executed by Another Workflow] --> B[Information Extractor]
B --> C[If - Phone Number Valid?]
C -->|Yes| D[Select rows from a table]
C -->|No| E[No Operation, do nothing]
D --> F[Edit Fields]
G[OpenRouter Chat Model] -.->|AI Model| B
Trigger¶
Execute Workflow Trigger: This workflow is designed to be called by other workflows, not run independently. It expects input data with a query field containing text that potentially includes phone numbers.
Nodes Used¶
| Node Type | Purpose |
|---|---|
| Execute Workflow Trigger | Receives input from calling workflows |
| Information Extractor | Uses AI to extract phone numbers from text input |
| OpenRouter Chat Model | Provides the AI language model for information extraction |
| If | Conditional logic to check if a valid phone number was extracted |
| Postgres | Queries the database for matching youth entrepreneur records |
| Set (Edit Fields) | Formats the output to return only the business summary |
| No Operation | Handles cases where no valid phone number is found |
External Services & Credentials Required¶
OpenRouter API¶
- Purpose: Provides AI language model capabilities for phone number extraction
- Credential Name:
OpenRouter account - Required: API key for OpenRouter service
PostgreSQL Database¶
- Purpose: Stores youth entrepreneur data including business summaries
- Credential Name:
PostgresOnSupabase - Required: Database connection details (host, port, database name, username, password)
- Table Used:
youthEntrepreneursReal
Environment Variables¶
No environment variables are explicitly configured in this workflow. All external service connections use n8n credential management.
Data Flow¶
Input¶
1 2 3 | |
Processing¶
- Extracts phone number: "+254794443378"
- Queries database for matching phoneNumber
- Retrieves business_summary field
Output¶
1 2 3 | |
No Match Output¶
If no valid phone number is found or no database match exists, the workflow returns no data.
Error Handling¶
The workflow includes basic error handling through conditional logic:
- Invalid Phone Numbers: The Information Extractor returns "0" when no valid phone number is found, which triggers the "No Operation" path
- Database Misses: If the phone number doesn't match any records, the workflow will return empty results
- Missing Input: The workflow expects a
queryfield in the input data
No explicit error catching or retry mechanisms are implemented.
Known Limitations¶
- Phone number extraction relies on AI interpretation, which may not be 100% accurate
- Only searches for exact phone number matches in the database (uses LIKE operator)
- No validation of phone number format beyond length (8+ digits)
- Workflow is inactive and must be manually enabled for use
- Single database table lookup only - no cross-referencing with other data sources
Related Workflows¶
This workflow is designed to be called by other workflows but no specific parent workflows are identified in the current configuration.
Setup Instructions¶
-
Import Workflow: Import the JSON configuration into your n8n instance
-
Configure Credentials:
- Set up OpenRouter API credentials with your API key
- Configure PostgreSQL connection to your Supabase database
- Ensure the
youthEntrepreneursRealtable exists with required fields
-
Database Requirements:
- Table:
youthEntrepreneursReal - Required columns:
phoneNumber,business_summary - Ensure proper indexing on
phoneNumberfor performance
- Table:
-
Test the Workflow:
- Use the pinned test data or create a calling workflow
- Verify phone number extraction works with your expected input formats
- Confirm database connectivity and data retrieval
-
Activate: Enable the workflow when ready for production use
-
Integration: Call this workflow from other workflows using the Execute Workflow node, passing data in the format
{"query": "your text with phone number"}