getSummary_testing¶
This workflow extracts phone numbers from query strings, normalizes them to Kenyan format (+254), and retrieves business summary information for youth entrepreneurs from a PostgreSQL database.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
How It Works¶
- Trigger: The workflow starts when executed by another workflow, receiving input data with a query string
- Phone Number Extraction: A JavaScript code node parses the query string to extract phone numbers using regex patterns
- Phone Number Normalization: The extracted phone number is converted to standard Kenyan format (+254XXXXXXXXX)
- Validation Check: An IF condition verifies that a valid phone number was extracted (not equal to "0")
- Database Lookup: If valid, the workflow queries the
youthEntrepreneursRealtable to find matching records - Data Processing: The business summary field is extracted and formatted for output
- Error Handling: If no valid phone number is found, the workflow takes a no-operation path
Workflow Diagram¶
graph TD
A[When Executed by Another Workflow] --> B[Extract Phone Number]
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[When clicking 'Execute workflow'] --> H[Select rows from a table1]
Trigger¶
- Primary: Execute Workflow Trigger - Called by other workflows with passthrough input
- Secondary: Manual Trigger - For testing purposes
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Execute Workflow Trigger | When Executed by Another Workflow | Receives input from calling workflows |
| Code | Extract Phone Number | Parses and normalizes phone numbers from query strings |
| IF | If | Validates extracted phone number |
| Postgres | Select rows from a table | Queries youth entrepreneur database |
| Set | Edit Fields | Formats business summary output |
| No Operation | No Operation, do nothing | Handles invalid phone number cases |
| Manual Trigger | When clicking 'Execute workflow' | Manual testing trigger |
| Postgres | Select rows from a table1 | Testing database query |
External Services & Credentials Required¶
- PostgreSQL Database:
- Credential:
kdpTestEnv - Access to
youthEntrepreneursRealtable inpublicschema - Required permissions: SELECT
- Credential:
Environment Variables¶
No environment variables are explicitly used in this workflow.
Data Flow¶
Input¶
- Query string containing a phone number in various formats:
+2547070603972547070603970707060397707060397
Processing¶
- Phone number extraction and normalization to +254 format
- Database lookup by normalized phone number
- Business summary field extraction
Output¶
business_summary: String containing the business summary for the matched entrepreneur
Error Handling¶
- Invalid Phone Number: If no valid phone number is extracted, the workflow routes to a no-operation node
- No Database Match: The workflow continues even if no matching records are found in the database
- Regex Fallback: Returns phone number "0" if no valid pattern is matched
Known Limitations¶
- Only supports Kenyan phone number formats (+254)
- Relies on regex pattern matching which may not catch all edge cases
- No explicit error handling for database connection failures
- Testing components (manual trigger and secondary database query) are mixed with production logic
Related Workflows¶
This workflow is designed to be called by other workflows but no specific related workflows are documented.
Setup Instructions¶
- Import Workflow: Import the JSON into your n8n instance
- Configure Database Credential:
- Create a PostgreSQL credential named
kdpTestEnv - Ensure access to the
youthEntrepreneursRealtable
- Create a PostgreSQL credential named
- Database Schema: Verify the target table has these columns:
phoneNumber(for matching)business_summary(for output)
- Test the Workflow:
- Use the manual trigger with sample data
- Verify phone number extraction works with various formats
- Confirm database connectivity and data retrieval
- Integration: Call this workflow from other workflows, passing query strings containing phone numbers