Files
mc_cars_gmbh_infraestructure/n8n/workflows/01-qualification-payment-email.json
T

97 lines
5.9 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"name": "Lead Qualified → Payment Email",
"nodes": [
{
"parameters": {
"triggerOnNotify": true,
"channel": "lead_qualified",
"additionalFields": {}
},
"id": "pg-trigger",
"name": "Postgres Trigger",
"type": "n8n-nodes-base.postgresTrigger",
"typeVersion": 1,
"position": [250, 300],
"credentials": {
"postgres": {
"id": "1",
"name": "MC Cars Postgres"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT c.id, c.name, c.email, c.phone,\n so.order_number, so.total_eur, so.deposit_eur,\n so.date_from, so.date_to, so.vehicle_label,\n so.daily_subtotal, so.weekend_subtotal,\n so.subtotal_eur, so.vat_eur,\n so.total_days, so.weekday_count, so.weekend_day_count\nFROM public.customers c\nJOIN public.sales_orders so ON so.customer_id = c.id\nWHERE so.id = '{{ $json.sales_order_id }}'::uuid",
"additionalFields": {}
},
"id": "fetch-order-data",
"name": "Fetch Order Data",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.5,
"position": [470, 300],
"credentials": {
"postgres": {
"id": "1",
"name": "MC Cars Postgres"
}
}
},
{
"parameters": {
"fromEmail": "info@mc-cars.at",
"toEmail": "={{ $json.email }}",
"subject": "MC Cars Ihre Buchung {{ $json.order_number }} Zahlungsanweisungen",
"emailType": "html",
"html": "<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;\">\n <div style=\"background:#1a1a1a;padding:20px;text-align:center;\">\n <h1 style=\"color:#c87941;margin:0;\">MC Cars</h1>\n </div>\n <div style=\"padding:30px;background:#f9f9f9;\">\n <p>Sehr geehrte/r <strong>{{ $json.name }}</strong>,</p>\n <p>vielen Dank für Ihre Buchung! Hier sind Ihre Buchungsdetails und Zahlungsanweisungen:</p>\n \n <table style=\"width:100%;border-collapse:collapse;margin:20px 0;\">\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Bestellnummer:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\">{{ $json.order_number }}</td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Fahrzeug:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\">{{ $json.vehicle_label }}</td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Zeitraum:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\">{{ $json.date_from }} {{ $json.date_to }}</td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Tage gesamt:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\">{{ $json.total_days }}</td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Netto:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\">€{{ $json.subtotal_eur }}</td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>MwSt (19%):</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\">€{{ $json.vat_eur }}</td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Gesamtbetrag:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>€{{ $json.total_eur }}</strong></td></tr>\n <tr><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>Kaution:</strong></td><td style=\"padding:8px;border-bottom:1px solid #ddd;\"><strong>€{{ $json.deposit_eur }}</strong></td></tr>\n </table>\n\n <h3 style=\"color:#c87941;\">Zahlungsanweisungen</h3>\n \n <h4>1. Kaution (€{{ $json.deposit_eur }})</h4>\n <p>Bitte überweisen Sie die Kaution auf folgendes Konto:</p>\n <div style=\"background:#fff;padding:15px;border:1px solid #ddd;border-radius:5px;margin:10px 0;\">\n <p style=\"margin:5px 0;\"><strong>Empfänger:</strong> MC Cars GmbH</p>\n <p style=\"margin:5px 0;\"><strong>IBAN:</strong> AT00 0000 0000 0000 0000</p>\n <p style=\"margin:5px 0;\"><strong>BIC:</strong> BKAUATWW</p>\n <p style=\"margin:5px 0;\"><strong>Verwendungszweck:</strong> Kaution {{ $json.order_number }}</p>\n </div>\n\n <h4>2. Mietbetrag (€{{ $json.total_eur }})</h4>\n <p>Den Mietbetrag können Sie bequem online bezahlen:</p>\n <div style=\"text-align:center;margin:20px 0;\">\n <a href=\"https://mc-cars.at/zahlung/{{ $json.order_number }}\" style=\"background:#c87941;color:#fff;padding:12px 30px;text-decoration:none;border-radius:5px;font-weight:bold;\">Jetzt bezahlen</a>\n </div>\n <p style=\"font-size:0.85em;color:#666;\">Oder überweisen Sie auf dasselbe Konto mit Verwendungszweck: <strong>Miete {{ $json.order_number }}</strong></p>\n\n <hr style=\"border:none;border-top:1px solid #ddd;margin:25px 0;\" />\n <p>Bei Fragen stehen wir Ihnen jederzeit zur Verfügung.</p>\n <p>Mit freundlichen Grüßen,<br/><strong>MC Cars GmbH</strong><br/>info@mc-cars.at<br/>mc-cars.at</p>\n </div>\n</div>",
"options": {}
},
"id": "send-email",
"name": "Send Payment Email",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [690, 300],
"credentials": {
"smtp": {
"id": "2",
"name": "MC Cars SMTP"
}
}
}
],
"connections": {
"Postgres Trigger": {
"main": [
[
{
"node": "Fetch Order Data",
"type": "main",
"index": 0
}
]
]
},
"Fetch Order Data": {
"main": [
[
{
"node": "Send Payment Email",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [
{
"name": "mc-cars"
}
],
"triggerCount": 1
}