Move the two live-validated workflows into n8n/workflows/ (credential- based auth referenced by name only, no secret values), add a manifest covering all 4 canonical workflows and a read-only drift-check script against n8n's Public API. Retire the pre-integration root-level starter files that still carried the literal-token pattern, and repoint the Unraid deploy scripts, Makefile targets and runbook at the new files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
100 lines
3.0 KiB
JSON
100 lines
3.0 KiB
JSON
{
|
|
"id": "mobilityops-return-processing",
|
|
"name": "Fleet Ops — Vehicle Return Orchestration",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "mobilityops-return",
|
|
"authentication": "headerAuth",
|
|
"responseMode": "responseNode",
|
|
"options": {}
|
|
},
|
|
"id": "webhook-node",
|
|
"name": "Return webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 2,
|
|
"position": [240, 300],
|
|
"webhookId": "mobilityops-return",
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"name": "Fleet Ops Webhook Trigger Token"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const e = $json.body ?? $json;\nif (e.event_type !== 'vehicle.returned.v1') throw new Error('Unsupported event type');\nconst reasons = e.data?.attention_reasons ?? [];\nreturn [{json: {event_id: e.event_id, event_type: e.event_type, aggregate_ref: e.aggregate.public_ref, follow_up: reasons.length ? 'attention_required' : 'cleaning', summary: reasons.join('; ') || 'Create cleaning follow-up'}}];"
|
|
},
|
|
"id": "validate-node",
|
|
"name": "Validate and derive follow-up",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [500, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "http://192.168.10.150:1236/api/v1/integrations/n8n/return-callback",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Idempotency-Key",
|
|
"value": "={{$json.event_id}}"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"contentType": "raw",
|
|
"rawContentType": "application/json",
|
|
"body": "={{JSON.stringify($json)}}",
|
|
"options": {}
|
|
},
|
|
"id": "callback-node",
|
|
"name": "Record follow-up",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [760, 300],
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"name": "Fleet Ops Service Token"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "={{ { ok: true, event_id: $('Validate and derive follow-up').item.json.event_id, result: $json } }}",
|
|
"options": {}
|
|
},
|
|
"id": "response-node",
|
|
"name": "Return result",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1.4,
|
|
"position": [1020, 300]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Return webhook": {
|
|
"main": [[{ "node": "Validate and derive follow-up", "type": "main", "index": 0 }]]
|
|
},
|
|
"Validate and derive follow-up": {
|
|
"main": [[{ "node": "Record follow-up", "type": "main", "index": 0 }]]
|
|
},
|
|
"Record follow-up": {
|
|
"main": [[{ "node": "Return result", "type": "main", "index": 0 }]]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"active": true,
|
|
"meta": {
|
|
"templateCredsSetupCompleted": false
|
|
},
|
|
"tags": []
|
|
}
|