{"name": "Invoice Generator + Sender", "nodes": [{"id": "n1", "name": "Invoice Request Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2.1, "position": [0, 0], "parameters": {"httpMethod": "POST", "path": "generate-invoice", "responseMode": "responseNode"}}, {"id": "n2", "name": "Generate Invoice Content", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.4, "position": [224, 0], "parameters": {"method": "POST", "url": "https://api.anthropic.com/v1/messages", "sendHeaders": true, "headerParameters": {"parameters": [{"name": "x-api-key", "value": "YOUR_ANTHROPIC_API_KEY"}, {"name": "anthropic-version", "value": "2023-06-01"}, {"name": "content-type", "value": "application/json"}]}, "sendBody": true, "bodyParameters": {"parameters": [{"name": "model", "value": "claude-sonnet-4-6"}, {"name": "max_tokens", "value": "1500"}, {"name": "messages", "value": "=[{\"role\":\"user\",\"content\":\"Return ONLY JSON {invoice_number:string, html_invoice:string (full HTML with inline styles, professional layout), payment_terms:string, due_date:string}. Client: {{ JSON.stringify($json.body.client) }}. Items: {{ JSON.stringify($json.body.items) }}. Company: {{ $json.body.company }}\"}]"}]}}}, {"id": "n3", "name": "Send Invoice", "type": "n8n-nodes-base.gmail", "typeVersion": 2.2, "position": [448, 0], "parameters": {"resource": "message", "operation": "send", "sendTo": "{{ $json.body.client.email }}", "subject": "={{ JSON.parse($json.content[0].text).invoice_number }} \u2014 Invoice from {{ $json.body.company }}", "emailType": "html", "message": "={{ JSON.parse($json.content[0].text).html_invoice }}", "options": {}}, "credentials": {"gmailOAuth2": {"id": "YOUR_GMAIL_CREDENTIAL_ID", "name": "Gmail account"}}}, {"id": "n4", "name": "Respond", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.1, "position": [672, 0], "parameters": {"respondWith": "json", "responseBody": "={\"ok\":true,\"result\":\"{{ $json.content[0].text }}\"}"}}], "connections": {"Invoice Request Webhook": {"main": [[{"node": "Generate Invoice Content", "type": "main", "index": 0}]]}, "Generate Invoice Content": {"main": [[{"node": "Send Invoice", "type": "main", "index": 0}]]}, "Send Invoice": {"main": [[{"node": "Respond", "type": "main", "index": 0}]]}}, "settings": {"executionOrder": "v1"}}