{ "name": "BotKonzept - Trial Management & Email Automation", "nodes": [ { "parameters": { "rule": { "interval": [ { "field": "cronExpression", "expression": "0 9 * * *" } ] } }, "id": "daily-cron", "name": "Daily at 9 AM", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.1, "position": [250, 300] }, { "parameters": { "operation": "executeQuery", "query": "SELECT c.id as customer_id, c.email, c.first_name, c.last_name, c.company, c.created_at, c.status, i.ctid, i.hostname, i.fqdn, i.trial_end_date, i.credentials, EXTRACT(DAY FROM (NOW() - c.created_at)) as days_since_registration FROM customers c JOIN instances i ON c.id = i.customer_id WHERE c.status = 'trial' AND i.status = 'active' AND c.created_at >= NOW() - INTERVAL '8 days'", "additionalFields": {} }, "id": "get-trial-customers", "name": "Get Trial Customers", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, "position": [450, 300], "credentials": { "postgres": { "id": "supabase-local", "name": "Supabase Local" } } }, { "parameters": { "conditions": { "number": [ { "value1": "={{$json.days_since_registration}}", "operation": "equal", "value2": 3 } ] } }, "id": "check-day-3", "name": "Day 3?", "type": "n8n-nodes-base.if", "typeVersion": 1, "position": [650, 200] }, { "parameters": { "operation": "insert", "schema": "public", "table": "emails_sent", "columns": "customer_id,email_type,sent_at", "additionalFields": {} }, "id": "log-email-sent", "name": "Log Email Sent", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, "position": [1450, 200], "credentials": { "postgres": { "id": "supabase-local", "name": "Supabase Local" } } } ], "connections": { "Daily at 9 AM": { "main": [ [ { "node": "Get Trial Customers", "type": "main", "index": 0 } ] ] }, "Get Trial Customers": { "main": [ [ { "node": "Day 3?", "type": "main", "index": 0 } ] ] }, "Day 3?": { "main": [ [ { "node": "Log Email Sent", "type": "main", "index": 0 } ] ] } }, "pinData": {}, "settings": { "executionOrder": "v1" }, "staticData": null, "tags": [], "triggerCount": 0, "updatedAt": "2025-01-25T00:00:00.000Z", "versionId": "1" }