Neue Dateien: - BotKonzept-Customer-Registration-Workflow.json: n8n Workflow für Kundenregistrierung - BotKonzept-Trial-Management-Workflow.json: n8n Workflow für Trial-Management - REGISTRATION_SETUP_GUIDE.md: Kompletter Setup-Guide (Datenbank, Credentials, Workflows) - REGISTRATION_TROUBLESHOOTING.md: Troubleshooting-Guide mit 10 häufigen Problemen Gelöscht: - 20250119_Logo_Botkozept.svg: Verschoben nach customer-frontend Die Workflows enthalten: - Webhook-Trigger für Registrierung - Datenbank-Integration (PostgreSQL/Supabase) - SSH-Integration zu PVE20 für LXC-Erstellung - E-Mail-Versand (Willkommens-E-Mail) - Trial-Management mit automatischen E-Mails (Tag 3, 5, 7) Setup-Guide erklärt: - Datenbank-Schema einrichten - n8n Credentials konfigurieren (Supabase, SSH, SMTP) - Workflows importieren und aktivieren - Testing und Monitoring Troubleshooting-Guide behandelt: - Workflow-Probleme - Credential-Fehler - SSH-Verbindungsprobleme - Datenbank-Fehler - E-Mail-Versand-Probleme - JSON-Parsing-Fehler - Performance-Probleme - Debugging-Checkliste
313 lines
12 KiB
JSON
313 lines
12 KiB
JSON
{
|
|
"name": "BotKonzept - Customer Registration & Trial Management",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "botkonzept-registration",
|
|
"responseMode": "responseNode",
|
|
"options": {}
|
|
},
|
|
"id": "webhook-registration",
|
|
"name": "Registration Webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 1.1,
|
|
"position": [250, 300],
|
|
"webhookId": "botkonzept-registration"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"string": [
|
|
{
|
|
"value1": "={{$json.body.email}}",
|
|
"operation": "isNotEmpty"
|
|
},
|
|
{
|
|
"value1": "={{$json.body.firstName}}",
|
|
"operation": "isNotEmpty"
|
|
},
|
|
{
|
|
"value1": "={{$json.body.lastName}}",
|
|
"operation": "isNotEmpty"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"id": "validate-input",
|
|
"name": "Validate Input",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 1,
|
|
"position": [450, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "insert",
|
|
"schema": "public",
|
|
"table": "customers",
|
|
"columns": "email,first_name,last_name,company,status,created_at,trial_end_date",
|
|
"additionalFields": {
|
|
"returnFields": "*"
|
|
}
|
|
},
|
|
"id": "create-customer",
|
|
"name": "Create Customer in DB",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.4,
|
|
"position": [650, 200],
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "supabase-local",
|
|
"name": "Supabase Local"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"authentication": "privateKey",
|
|
"command": "=/root/customer-installer/install.sh --storage local-zfs --bridge vmbr0 --ip dhcp --vlan 90 --apt-proxy http://192.168.45.2:3142 --n8n-owner-email {{ $json.email }} --n8n-owner-pass \"{{ $('Generate-Password').item.json.password }}\"",
|
|
"cwd": "/root/customer-installer/"
|
|
},
|
|
"id": "create-instance",
|
|
"name": "Create Customer Instance",
|
|
"type": "n8n-nodes-base.ssh",
|
|
"typeVersion": 1,
|
|
"position": [850, 200],
|
|
"credentials": {
|
|
"sshPrivateKey": {
|
|
"id": "pve20-ssh",
|
|
"name": "PVE20"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Parse installation output\nconst stdout = $input.item.json.stdout;\nconst installData = JSON.parse(stdout);\n\n// Add customer info\ninstallData.customer = {\n id: $('Create Customer in DB').item.json.id,\n email: $('Create Customer in DB').item.json.email,\n firstName: $('Create Customer in DB').item.json.first_name,\n lastName: $('Create Customer in DB').item.json.last_name,\n company: $('Create Customer in DB').item.json.company\n};\n\nreturn installData;"
|
|
},
|
|
"id": "parse-install-output",
|
|
"name": "Parse Install Output",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [1050, 200]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "insert",
|
|
"schema": "public",
|
|
"table": "instances",
|
|
"columns": "customer_id,ctid,hostname,ip,fqdn,status,credentials,created_at,trial_end_date",
|
|
"additionalFields": {}
|
|
},
|
|
"id": "save-instance",
|
|
"name": "Save Instance to DB",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.4,
|
|
"position": [1250, 200],
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "supabase-local",
|
|
"name": "Supabase Local"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"fromEmail": "noreply@botkonzept.de",
|
|
"toEmail": "={{ $json.customer.email }}",
|
|
"subject": "Willkommen bei BotKonzept - Ihre Instanz ist bereit! 🎉",
|
|
"emailType": "html",
|
|
"message": "=<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <style>\n body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n .container { max-width: 600px; margin: 0 auto; padding: 20px; }\n .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center; border-radius: 10px 10px 0 0; }\n .content { background: #f9fafb; padding: 30px; }\n .credentials { background: white; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #667eea; }\n .button { display: inline-block; background: #667eea; color: white; padding: 12px 30px; text-decoration: none; border-radius: 6px; margin: 20px 0; }\n .footer { text-align: center; padding: 20px; color: #6b7280; font-size: 14px; }\n .highlight { background: #fef3c7; padding: 2px 6px; border-radius: 3px; }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <div class=\"header\">\n <h1>🎉 Willkommen bei BotKonzept!</h1>\n <p>Ihre KI-Chatbot-Instanz ist bereit</p>\n </div>\n \n <div class=\"content\">\n <p>Hallo {{ $json.customer.firstName }},</p>\n \n <p>vielen Dank für Ihre Registrierung! Ihre persönliche KI-Chatbot-Instanz wurde erfolgreich erstellt und ist jetzt einsatzbereit.</p>\n \n <div class=\"credentials\">\n <h3>📋 Ihre Zugangsdaten</h3>\n <p><strong>Dashboard-URL:</strong><br>\n <a href=\"{{ $json.urls.n8n_external }}\">{{ $json.urls.n8n_external }}</a></p>\n \n <p><strong>E-Mail:</strong> {{ $json.n8n.owner_email }}<br>\n <strong>Passwort:</strong> <span class=\"highlight\">{{ $json.n8n.owner_password }}</span></p>\n \n <p><strong>Chat-Webhook:</strong><br>\n <code>{{ $json.urls.chat_webhook }}</code></p>\n \n <p><strong>Upload-Formular:</strong><br>\n <a href=\"{{ $json.urls.upload_form }}\">{{ $json.urls.upload_form }}</a></p>\n </div>\n \n <h3>🚀 Nächste Schritte:</h3>\n <ol>\n <li><strong>Einloggen:</strong> Klicken Sie auf den Link oben und loggen Sie sich ein</li>\n <li><strong>Dokumente hochladen:</strong> Laden Sie Ihre PDFs, FAQs oder andere Dokumente hoch</li>\n <li><strong>Chatbot testen:</strong> Testen Sie Ihren Chatbot direkt im Dashboard</li>\n <li><strong>Code einbinden:</strong> Kopieren Sie den Widget-Code auf Ihre Website</li>\n </ol>\n \n <a href=\"{{ $json.urls.n8n_external }}\" class=\"button\">Jetzt Dashboard öffnen →</a>\n \n <div style=\"background: #fef3c7; padding: 15px; border-radius: 8px; margin: 20px 0;\">\n <p><strong>💰 Frühbucher-Angebot:</strong></p>\n <p>Upgraden Sie in den nächsten 3 Tagen und erhalten Sie <strong>30% Rabatt</strong> auf Ihr erstes Jahr!</p>\n </div>\n \n <p><strong>Trial-Zeitraum:</strong> 7 Tage (bis {{ $json.trial_end_date }})</p>\n \n <p>Bei Fragen stehen wir Ihnen jederzeit zur Verfügung!</p>\n \n <p>Viel Erfolg mit Ihrem KI-Chatbot!<br>\n Ihr BotKonzept-Team</p>\n </div>\n \n <div class=\"footer\">\n <p>BotKonzept | KI-Chatbots für moderne Unternehmen</p>\n <p><a href=\"https://botkonzept.de\">botkonzept.de</a> | <a href=\"mailto:support@botkonzept.de\">support@botkonzept.de</a></p>\n </div>\n </div>\n</body>\n</html>",
|
|
"options": {
|
|
"allowUnauthorizedCerts": false
|
|
}
|
|
},
|
|
"id": "send-welcome-email",
|
|
"name": "Send Welcome Email",
|
|
"type": "n8n-nodes-base.emailSend",
|
|
"typeVersion": 2.1,
|
|
"position": [1450, 200],
|
|
"credentials": {
|
|
"smtp": {
|
|
"id": "postfix-ses",
|
|
"name": "Postfix SES"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "insert",
|
|
"schema": "public",
|
|
"table": "emails_sent",
|
|
"columns": "customer_id,email_type,sent_at",
|
|
"additionalFields": {}
|
|
},
|
|
"id": "log-email",
|
|
"name": "Log Email Sent",
|
|
"type": "n8n-nodes-base.postgres",
|
|
"typeVersion": 2.4,
|
|
"position": [1650, 200],
|
|
"credentials": {
|
|
"postgres": {
|
|
"id": "supabase-local",
|
|
"name": "Supabase Local"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "={{ { \"success\": true, \"message\": \"Registrierung erfolgreich! Sie erhalten in Kürze eine E-Mail mit Ihren Zugangsdaten.\", \"customerId\": $json.customer.id, \"instanceUrl\": $json.urls.n8n_external } }}",
|
|
"options": {
|
|
"responseCode": 200
|
|
}
|
|
},
|
|
"id": "success-response",
|
|
"name": "Success Response",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1,
|
|
"position": [1850, 200]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "={{ { \"success\": false, \"error\": \"Ungültige Eingabedaten. Bitte überprüfen Sie Ihre Angaben.\" } }}",
|
|
"options": {
|
|
"responseCode": 400
|
|
}
|
|
},
|
|
"id": "error-response",
|
|
"name": "Error Response",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1,
|
|
"position": [650, 400]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Generate secure password\nconst length = 16;\nconst charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';\nlet password = '';\n\nfor (let i = 0; i < length; i++) {\n const randomIndex = Math.floor(Math.random() * charset.length);\n password += charset[randomIndex];\n}\n\n// Calculate trial end date (7 days from now)\nconst trialEndDate = new Date();\ntrialEndDate.setDate(trialEndDate.getDate() + 7);\n\nreturn {\n password: password,\n trialEndDate: trialEndDate.toISOString(),\n email: $json.body.email,\n firstName: $json.body.firstName,\n lastName: $json.body.lastName,\n company: $json.body.company || null\n};"
|
|
},
|
|
"id": "generate-password",
|
|
"name": "Generate Password & Trial Date",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [650, 100]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Registration Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Validate Input",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Validate Input": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Generate Password & Trial Date",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Error Response",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Generate Password & Trial Date": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Create Customer in DB",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Create Customer in DB": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Create Customer Instance",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Create Customer Instance": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse Install Output",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse Install Output": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Save Instance to DB",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Save Instance to DB": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Send Welcome Email",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Send Welcome Email": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Log Email Sent",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Log Email Sent": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Success Response",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"pinData": {},
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"staticData": null,
|
|
"tags": [],
|
|
"triggerCount": 0,
|
|
"updatedAt": "2025-01-25T00:00:00.000Z",
|
|
"versionId": "1"
|
|
}
|