{"name": "Churn Risk Predictor + Intervention", "nodes": [{"id": "n1", "name": "Every Sunday 8AM", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.3, "position": [0, 0], "parameters": {"rule": {"interval": [{"triggerAtHour": 8, "mode": "everyWeek", "triggerAtDay": 0}]}}}, {"id": "n2", "name": "Get At-Risk Users", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.4, "position": [224, 0], "parameters": {"method": "GET", "url": "https://YOUR_PROJECT.supabase.co/rest/v1/profiles?select=*&last_login=lt.2026-01-01&limit=10", "sendHeaders": true, "headerParameters": {"parameters": [{"name": "apikey", "value": "YOUR_SUPABASE_ANON_KEY"}, {"name": "Authorization", "value": "Bearer YOUR_SUPABASE_ANON_KEY"}]}}}, {"id": "n3", "name": "Predict Churn & Write Email", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.4, "position": [448, 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": "800"}, {"name": "messages", "value": "=[{\"role\":\"user\",\"content\":\"Return ONLY JSON {churn_risk:'high/medium/low', reason:string, intervention_email:{subject,body}, offer:string}. User data: {{ JSON.stringify($json) }}\"}]"}]}}}, {"id": "n4", "name": "Send Intervention", "type": "n8n-nodes-base.gmail", "typeVersion": 2.2, "position": [672, 0], "parameters": {"resource": "message", "operation": "send", "sendTo": "{{ $json.email }}", "subject": "={{ JSON.parse($json.content[0].text).intervention_email.subject }}", "emailType": "html", "message": "={{ JSON.parse($json.content[0].text).intervention_email.body }}", "options": {}}, "credentials": {"gmailOAuth2": {"id": "YOUR_GMAIL_CREDENTIAL_ID", "name": "Gmail account"}}}], "connections": {"Every Sunday 8AM": {"main": [[{"node": "Get At-Risk Users", "type": "main", "index": 0}]]}, "Get At-Risk Users": {"main": [[{"node": "Predict Churn & Write Email", "type": "main", "index": 0}]]}, "Predict Churn & Write Email": {"main": [[{"node": "Send Intervention", "type": "main", "index": 0}]]}}, "settings": {"executionOrder": "v1"}}