{ "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": { "timeout": 15000 } }, "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" } }, "retryOnFail": true, "maxTries": 3, "waitBetweenTries": 1000 }, { "parameters": { "method": "POST", "url": "http://192.168.10.150:1236/api/v1/integrations/n8n/heartbeat", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "contentType": "json", "specifyBody": "keypair", "bodyParameters": { "parameters": [ { "name": "workflow_id", "value": "={{ $workflow.id }}" }, { "name": "workflow_name", "value": "={{ $workflow.name }}" }, { "name": "execution_id", "value": "={{ $execution.id }}" }, { "name": "status", "value": "succeeded" } ]}, "options": { "timeout": 15000 } }, "id": "heartbeat-node", "name": "Report workflow heartbeat", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [980, 300], "credentials": { "httpHeaderAuth": { "name": "Fleet Ops Service Token" } }, "retryOnFail": true, "maxTries": 3, "waitBetweenTries": 1000 }, { "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": [1220, 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": "Report workflow heartbeat", "type": "main", "index": 0 }]] }, "Report workflow heartbeat": { "main": [[{ "node": "Return result", "type": "main", "index": 0 }]] } }, "settings": { "executionOrder": "v1" }, "active": true, "meta": { "templateCredsSetupCompleted": false }, "tags": [] }