An AI-powered customer support workflow that classifies incoming inquiries, generates response drafts, escalates sensitive requests for human review, and records interactions for tracking and evaluation.
Built with n8n, OpenAI, JavaScript, REST APIs, Google Sheets, Gmail, and PowerShell.
Customer support teams often spend time sorting repetitive inquiries, preparing responses, and identifying issues requiring human attention.
I built JayEx AI Customer Support Automation to demonstrate how AI and workflow automation can streamline these processes while maintaining human oversight.
The system accepts customer inquiries through an authenticated webhook, uses an LLM to classify the request, and routes it through the appropriate workflow.
This is a portfolio demonstration using fictional customer information and a demo business. It has not been deployed for a paying client.
The primary workflow validates authenticated requests, classifies inquiries, drafts responses for eligible messages, and routes sensitive cases to a human reviewer. View the public workflow JSON.
A separate Error Trigger workflow captures execution failures and sends a Gmail alert with workflow, node, error, and execution details. View the error handler JSON.
An authenticated webhook invokes a Stop And Error node to verify that the error handler fires as expected. View the simulation JSON.
Screenshots show the n8n editor; the published JSON exports have credentials and deployment-specific references removed.
- AI Classification: Categorizes incoming messages as general information, appointments, billing, or other.
- AI Response Drafting: Creates responses without automatically sending them to customers.
- Human-in-the-Loop: Escalates billing disputes and flagged inquiries.
- Input Validation: Rejects invalid submissions before AI processing.
- Webhook Security: Uses HTTP Header Authentication.
- HTTP Responses: Returns 202 for accepted inquiries and 400 for invalid submissions.
- Google Sheets Integration: Records customer inquiries and AI outputs.
- Gmail Notifications: Alerts reviewers about escalated inquiries.
- Error Monitoring: Sends notifications when workflow executions fail.
- Automated Evaluation: Tests classification and escalation decisions using PowerShell.
| Technology | Purpose |
|---|---|
| n8n | Workflow orchestration |
| OpenAI GPT-4o-mini | Inquiry classification and response generation |
| JavaScript | Input validation, parsing, and workflow data processing |
| REST APIs / Webhooks | Receiving external customer inquiries |
| Google Sheets | Logging inquiries and AI outputs |
| Gmail | Human-review notifications |
| PowerShell | Automated API tests and AI evaluation |
| CSV | Test results and evaluation reports |
flowchart TD
A[Customer Inquiry] --> B[Authenticated Webhook]
B --> C[Validate Customer Input]
C --> D{Valid Input?}
D -->|No| E[HTTP 400 Bad Request]
D -->|Yes| F[HTTP 202 Accepted]
F --> G[OpenAI Classification]
G --> H[JavaScript Validation]
H --> I{Human Review Required?}
I -->|Yes| J[Prepare Human Review]
J --> K[Google Sheets Logging]
K --> L[Gmail Reviewer Notification]
I -->|No| M[AI Response Generator]
M --> N[Prepare Support Log]
N --> O[Google Sheets Logging]
A separate n8n error-handling workflow monitors execution failures and sends notification emails.
The AI classifies inquiries into four categories:
| Category | Example |
|---|---|
| general_information | What are your business hours? |
| appointment | Can I schedule an appointment? |
| billing | I was charged twice. |
| other | I need help with an issue. |
The JavaScript validation node checks whether the AI returns the expected JSON structure.
If parsing or validation fails, the request is flagged for human review.
Billing classifications and AI-reported confidence scores below 0.80 also trigger mandatory human review.
The confidence score is generated by the language model and is not a calibrated probability of correctness.
The workflow receives JSON requests containing customer information.
{
"customerName": "Alex Johnson",
"email": "alex@example.com",
"message": "What are your business hours?",
"testId": "optional-test-identifier"
}The testId field is optional and supports evaluation tracking.
HTTP status: 202 Accepted
{
"success": true,
"message": "Customer inquiry accepted for processing."
}HTTP status: 400 Bad Request
{
"success": false,
"errors": ["A valid email address is required."]
}The webhook acknowledges valid requests before downstream AI processing finishes. Therefore, HTTP 202 does not guarantee successful classification or logging.
Unauthorized requests are rejected by n8n's Header Authentication.
I built PowerShell scripts to submit test inquiries and evaluate the resulting workflow decisions.
Testing covers:
- Valid HTTP requests
- Missing email addresses
- Invalid email formats
- Business-hours questions
- Appointment requests
- Billing disputes
- Customer complaints
- Unclear inquiries
- A prompt-injection attempt
| Metric | Observed result |
|---|---|
| API validation tests | 3/3 passed |
| AI classification and escalation tests | 6/6 passed |
| AI evaluation pass rate | 100% on six test cases |
| Error notification simulation | Passed |
The six AI evaluation scenarios measured category classification and human-review routing. These results do not establish production-wide AI accuracy or general prompt-injection resistance.
Each evaluation request includes a unique test ID that links expected outcomes to the actual Google Sheets results.
The scoring script compares the expected category and human-review decision against the recorded outputs, then generates an evaluation report.
The main automation uses a separate n8n Error Trigger workflow for execution-failure notifications.
To validate the monitoring process, I created a controlled failure simulation using a Webhook and Stop And Error node.
The simulation confirmed that n8n recorded the failure and the error handler automatically delivered an email alert.
The error handler provides monitoring and notification; it does not currently implement automatic retries or recovery.
- Import
workflows/jayex-customer-support-public.jsoninto n8n. - Configure your own Header Authentication credential.
- Connect an OpenAI-compatible credential supported by your n8n instance.
- Create a Google spreadsheet with the required logging columns.
- Configure both Google Sheets nodes with your document and worksheet.
- Connect your Gmail credential and replace the demo review email.
- Configure your own business information in the AI Response Generator.
- Import
workflows/jayex-error-handler.jsonand configure its Gmail credential and recipient address. - Import
workflows/jayex-error-simulation.jsonif you want to reproduce the failure test; configure its Header Authentication credential. - In the main workflow settings (and simulation workflow settings if testing), select your imported Error Handler as the error workflow.
- Test the workflows before publishing. Keep the simulation disabled except during controlled tests.
The public workflow intentionally excludes private credentials, spreadsheet identifiers, and deployment-specific settings.
The test scripts are designed for PowerShell 7. Set the webhook URL for your own instance in the current PowerShell session; .env.example documents the required variable but is not automatically loaded.
$env:JAYEX_WEBHOOK_URL = "https://your-instance.app.n8n.cloud/webhook/customer-support"Run the API validation tests:
pwsh -NoProfile -File .\test-webhook.ps1Run the AI evaluation submissions:
pwsh -NoProfile -File .\test-ai-evaluation.ps1The scripts prompt for a Header Authentication API key when run. Do not commit real keys or customer data.
Export the Google Sheets results as actual-results.csv, then generate an evaluation report:
pwsh -NoProfile -File .\score-ai-evaluation.ps1- The workflow uses a demo business and fictional customer data.
- Responses are drafts and are not automatically sent to customers.
- Model-reported confidence is not independently calibrated.
- Google Sheets is used as a lightweight logging system.
- Evaluation currently covers a small set of test scenarios.
- The error handler sends alerts but does not automatically recover failed executions.
- Production use would require broader testing, stronger privacy controls, and operational monitoring.
- Expand automated evaluation datasets.
- Add retry and recovery strategies for external API failures.
- Move business information into a maintainable knowledge source.
- Develop a dashboard for support and automation metrics.
- Add an authenticated reviewer approval workflow.
- Improve observability and reporting.
Functional portfolio prototype — tested using fictional customer scenarios.
Developed as an independent AI Automation Engineering project under JayEX.


