The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "BTS AI Response Quality Monitor",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 1
}
]
}
},
"id": "schedule-trigger",
"name": "Every Hour",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
250,
300
]
},
{
"parameters": {
"method": "GET",
"url": "http://localhost:5001/api/monitoring/ai-metrics",
"options": {
"timeout": 30000
}
},
"id": "get-metrics",
"name": "Get AI Metrics from BTS",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
500,
300
],
"continueOnFail": true
},
{
"parameters": {
"jsCode": "// Analyze AI performance metrics\nconst metrics = $input.first().json;\n\n// Default metrics if endpoint doesn't exist yet\nconst defaultMetrics = {\n totalRequests: 0,\n successfulRequests: 0,\n failedRequests: 0,\n averageResponseTime: 0,\n providerBreakdown: {\n openrouter: { requests: 0, avgTime: 0, errors: 0 },\n gemini: { requests: 0, avgTime: 0, errors: 0 },\n replicate: { requests: 0, avgTime: 0, errors: 0 }\n }\n};\n\nconst data = metrics.error ? defaultMetrics : (metrics.data || metrics);\n\n// Calculate quality scores\nconst successRate = data.totalRequests > 0 \n ? (data.successfulRequests / data.totalRequests * 100).toFixed(2) \n : 100;\n\nconst avgResponseTime = data.averageResponseTime || 0;\n\n// Quality thresholds\nconst qualityReport = {\n timestamp: new Date().toISOString(),\n period: 'last_hour',\n metrics: {\n totalRequests: data.totalRequests || 0,\n successRate: parseFloat(successRate),\n failedRequests: data.failedRequests || 0,\n averageResponseTime: avgResponseTime,\n providerBreakdown: data.providerBreakdown || defaultMetrics.providerBreakdown\n },\n quality: {\n responseTimeScore: avgResponseTime < 2000 ? 'excellent' : avgResponseTime < 5000 ? 'good' : 'poor',\n reliabilityScore: successRate >= 99 ? 'excellent' : successRate >= 95 ? 'good' : 'poor',\n overallScore: successRate >= 95 && avgResponseTime < 3000 ? 'healthy' : 'needs_attention'\n },\n alerts: []\n};\n\n// Generate alerts\nif (parseFloat(successRate) < 95) {\n qualityReport.alerts.push({\n type: 'low_success_rate',\n message: `Success rate dropped to ${successRate}%`,\n severity: successRate < 90 ? 'critical' : 'warning'\n });\n}\n\nif (avgResponseTime > 5000) {\n qualityReport.alerts.push({\n type: 'slow_response',\n message: `Average response time is ${avgResponseTime}ms`,\n severity: avgResponseTime > 10000 ? 'critical' : 'warning'\n });\n}\n\nqualityReport.hasAlerts = qualityReport.alerts.length > 0;\nqualityReport.hasCriticalAlerts = qualityReport.alerts.some(a => a.severity === 'critical');\n\nreturn qualityReport;"
},
"id": "analyze-metrics",
"name": "Analyze Quality Metrics",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
750,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "has-alerts",
"leftValue": "={{ $json.hasCriticalAlerts }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "check-critical",
"name": "Critical Alerts?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1000,
300
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.telegram.org/bot{{ $env.TELEGRAM_BOT_TOKEN }}/sendMessage",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"chat_id\": \"{{ $env.BOSS_MARC_TELEGRAM_ID }}\",\n \"text\": \"\ud83d\udcca *BTS AI Quality Report*\\n\\n*Period:* Last Hour\\n*Time:* {{ $json.timestamp }}\\n\\n\ud83d\udcc8 *Metrics:*\\n\u2022 Total Requests: {{ $json.metrics.totalRequests }}\\n\u2022 Success Rate: {{ $json.metrics.successRate }}%\\n\u2022 Failed Requests: {{ $json.metrics.failedRequests }}\\n\u2022 Avg Response Time: {{ $json.metrics.averageResponseTime }}ms\\n\\n\ud83c\udfaf *Quality Scores:*\\n\u2022 Response Time: {{ $json.quality.responseTimeScore }}\\n\u2022 Reliability: {{ $json.quality.reliabilityScore }}\\n\u2022 Overall: {{ $json.quality.overallScore }}\\n\\n{{ $json.alerts.length > 0 ? '\u26a0\ufe0f *Alerts:*\\n' + $json.alerts.map(a => '\u2022 ' + a.message).join('\\n') : '\u2705 No issues detected' }}\",\n \"parse_mode\": \"Markdown\"\n}"
},
"id": "send-critical-alert",
"name": "Send Critical Alert",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1250,
200
]
},
{
"parameters": {
"method": "POST",
"url": "http://localhost:5001/api/monitoring/ai-quality-report",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json) }}"
},
"id": "store-report",
"name": "Store Quality Report",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1250,
400
],
"continueOnFail": true
}
],
"connections": {
"Every Hour": {
"main": [
[
{
"node": "Get AI Metrics from BTS",
"type": "main",
"index": 0
}
]
]
},
"Get AI Metrics from BTS": {
"main": [
[
{
"node": "Analyze Quality Metrics",
"type": "main",
"index": 0
}
]
]
},
"Analyze Quality Metrics": {
"main": [
[
{
"node": "Critical Alerts?",
"type": "main",
"index": 0
}
]
]
},
"Critical Alerts?": {
"main": [
[
{
"node": "Send Critical Alert",
"type": "main",
"index": 0
}
],
[
{
"node": "Store Quality Report",
"type": "main",
"index": 0
}
]
]
},
"Send Critical Alert": {
"main": [
[
{
"node": "Store Quality Report",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [
{
"name": "BTS Delivery"
},
{
"name": "AI Monitoring"
},
{
"name": "Quality"
}
]
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
BTS AI Response Quality Monitor. Uses httpRequest. Scheduled trigger; 6 nodes.
Source: https://github.com/innovatehubph/bts-delivery/blob/26bb958764e52fab467da38333b0c259c7a84fd8/n8n-workflows/ai-quality-monitor.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Proactively alert to service endpoint changes and pod/container issues (Pending, Not Ready, Restart spikes) using Prometheus metrics, formatted and sent to Slack.
Tired of being let down by the Google Drive Trigger? Rather not exhaust system resources by polling every minute? Then this workflow is for you!
Triggers at a regular interval or via a webhook request. Solves AWS WAF challenge then makes a request to fetch the product page. Extracts product data from the retrieved HTML page. Compares the curre
🔄 Monitor Container Images from Docker Hub or GHCR.
Automatically monitor billable Kimai projects every weekday morning and receive a formatted HTML email when a project deadline is approaching or its hour budget is running low. If nothing requires att