{"name": "Ep11 - New Booking (with error alerts)", "nodes": [
{"parameters": {"formTitle": "New Booking", "formDescription": "Book a visit. We confirm by email within a minute.", "formFields": {"values": [{"fieldLabel": "Customer name", "requiredField": true}, {"fieldLabel": "Email", "requiredField": true}, {"fieldLabel": "Service", "requiredField": true}, {"fieldLabel": "Preferred date", "requiredField": true}]}, "options": {}}, "id": "e1", "name": "New Booking", "type": "n8n-nodes-base.formTrigger", "typeVersion": 2.2, "position": [0, 0], "webhookId": "ep11-new-booking"},
{"parameters": {"assignments": {"assignments": [{"id": "s1", "name": "name", "value": "={{ $json['Customer name'] }}", "type": "string"}, {"id": "s2", "name": "email", "value": "={{ $json.Email }}", "type": "string"}, {"id": "s3", "name": "service", "value": "={{ $json.Service }}", "type": "string"}, {"id": "s4", "name": "date", "value": "={{ $json['Preferred date'] }}", "type": "string"}, {"id": "s5", "name": "received", "value": "={{ $now.toFormat('yyyy-MM-dd HH:mm') }}", "type": "string"}]}, "options": {}}, "id": "e2", "name": "Tidy Fields", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [240, 0]},
{"parameters": {"conditions": {"options": {"caseSensitive": true, "leftValue": "", "typeValidation": "strict"}, "conditions": [{"id": "c1", "leftValue": "={{ $json.email }}", "rightValue": "@", "operator": {"type": "string", "operation": "contains"}}], "combinator": "and"}, "options": {}}, "id": "e3", "name": "Email Looks Real?", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [480, 0]},
{"parameters": {"method": "POST", "url": "https://httpbin.org/status/503", "sendBody": true, "bodyParameters": {"parameters": [{"name": "name", "value": "={{ $json.name }}"}, {"name": "email", "value": "={{ $json.email }}"}, {"name": "service", "value": "={{ $json.service }}"}, {"name": "date", "value": "={{ $json.date }}"}]}, "options": {}}, "id": "e4", "name": "Save to CRM", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [740, -100], "retryOnFail": true, "maxTries": 3, "waitBetweenTries": 2000, "notes": "Demo: this test address always answers 503 so you can watch the alert fire. Swap for your CRM endpoint.", "notesInFlow": true},
{"parameters": {"sendTo": "={{ $json.email }}", "subject": "=Booking received, {{ $json.name }}", "emailType": "text", "message": "=Hi {{ $json.name }},\n\nWe have your booking for: {{ $json.service }}\nPreferred date: {{ $json.date }}\n\nWe will confirm the time shortly. Reply to this email if anything changes.\n\nThanks,\nThe Team", "options": {"appendAttribution": false, "senderName": "OwnerAutomate Demo"}}, "id": "e5", "name": "Confirm to Customer", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [1000, -100], "credentials": {"gmailOAuth2": {"id": "avT0HSTU0k73ksRU", "name": "Gmail (OwnerAutomate)"}}},
{"parameters": {"operation": "completion", "completionTitle": "=Booking received, {{ $('Tidy Fields').item.json.name }}", "completionMessage": "Check your inbox for the confirmation.", "options": {}}, "id": "e6", "name": "Booked", "type": "n8n-nodes-base.form", "typeVersion": 1, "position": [1260, -100]},
{"parameters": {"errorMessage": "=Booking from {{ $json.name }} has no usable email: {{ $json.email }}"}, "id": "e7", "name": "Stop: Bad Email", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [740, 120]},
{"parameters": {}, "id": "e8", "name": "Something Failed", "type": "n8n-nodes-base.errorTrigger", "typeVersion": 1, "position": [0, 340]},
{"parameters": {"sendTo": "hello@ownerautomate.com", "subject": "=FAILED: {{ $json.workflow.name }} at {{ $json.execution.lastNodeExecuted }}", "emailType": "text", "message": "=Workflow: {{ $json.workflow.name }}\nNode: {{ $json.execution.lastNodeExecuted }}\nError: {{ $json.execution.error.message }}\nWhen: {{ $now.toFormat('yyyy-MM-dd HH:mm') }}\n\nOpen the run:\n{{ $json.execution.url }}", "options": {"appendAttribution": false, "senderName": "n8n alerts"}}, "id": "e9", "name": "Alert the Owner", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [240, 340], "credentials": {"gmailOAuth2": {"id": "avT0HSTU0k73ksRU", "name": "Gmail (OwnerAutomate)"}}}
], "connections": {"New Booking": {"main": [[{"node": "Tidy Fields", "type": "main", "index": 0}]]}, "Tidy Fields": {"main": [[{"node": "Email Looks Real?", "type": "main", "index": 0}]]}, "Email Looks Real?": {"main": [[{"node": "Save to CRM", "type": "main", "index": 0}], [{"node": "Stop: Bad Email", "type": "main", "index": 0}]]}, "Save to CRM": {"main": [[{"node": "Confirm to Customer", "type": "main", "index": 0}]]}, "Confirm to Customer": {"main": [[{"node": "Booked", "type": "main", "index": 0}]]}, "Something Failed": {"main": [[{"node": "Alert the Owner", "type": "main", "index": 0}]]}}, "settings": {"executionOrder": "v1"}}
