n8n Workflows – MC Cars
This folder contains exportable n8n workflow definitions for the MC Cars qualification automation.
Workflows
01 – Qualification Payment Email
Trigger: Postgres NOTIFY on channel lead_qualified (fires when qualify_lead() creates a sales order).
Flow:
- Receives notification with
sales_order_id,customer_id, etc. - Fetches full order + customer data from Postgres.
- Sends HTML email to customer with:
- Booking summary (vehicle, dates, pricing)
- Kaution bank transfer instructions
- Payment link for the rental amount
02 – Mietvertrag PDF Email
Trigger: Same lead_qualified Postgres notification.
Flow:
- Checks if
mietvertrag_template_pathis set insite_settings. - If no template → workflow stops (no error).
- If template exists:
- Fetches customer + sales order data
- Downloads DOCX template from
document-templatesstorage bucket - Fills placeholders using JSZip (in a Code node)
- Converts filled DOCX to PDF via Gotenberg
- Sends PDF as email attachment to customer
Setup Instructions
1. Create Postgres credential in n8n
- Name:
MC Cars Postgres - Host:
db - Port:
5432 - Database:
postgres - User:
postgres - Password: (value of
POSTGRES_PASSWORDfrom.env)
2. Create SMTP credential in n8n
- Name:
MC Cars SMTP - Host:
heracles.mxrouting.net - Port:
587(STARTTLS) or465(SSL/TLS) - User:
office@mc-cars.at - Password: use the mailbox password provided out-of-band (do not commit secrets to git)
- From:
office@mc-cars.at
3. Mailbox reference (for future incoming-email workflows)
- IMAP host:
heracles.mxrouting.net(port993, SSL/TLS) - POP3 host:
heracles.mxrouting.net(port995, SSL/TLS) - Username:
office@mc-cars.at - Password: same mailbox password as SMTP
4. Import workflows
- Open n8n at http://localhost:55590
- Go to Workflows → Import from file
- Import
01-qualification-payment-email.json - Import
02-mietvertrag-pdf-email.json - Open each workflow → assign the credentials created above → Activate
5. Upload Mietvertrag template (optional)
- Open Admin panel → Einstellungen tab
- Upload a DOCX file in the "Mietvertrag-Vorlage" section
- The template should contain these placeholders:
| Placeholder | Replaced with |
|---|---|
{{KUNDE_NAME}} |
Customer full name |
{{KUNDE_EMAIL}} |
Customer email |
{{KUNDE_TELEFON}} |
Customer phone |
{{BESTELLNUMMER}} |
Sales order number (e.g. SO-2026-0001) |
{{FAHRZEUG}} |
Vehicle label (e.g. "Ferrari 488 GTB") |
{{DATUM_VON}} |
Rental start date (DD.MM.YYYY) |
{{DATUM_BIS}} |
Rental end date (DD.MM.YYYY) |
{{TAGE_GESAMT}} |
Total rental days |
{{WOCHENTAGE}} |
Number of weekdays |
{{WOCHENENDTAGE}} |
Number of weekend days |
{{TAGESSATZ}} |
Weekday daily subtotal |
{{WOCHENENDZUSCHLAG}} |
Weekend surcharge subtotal |
{{NETTO}} |
Net amount (excl. VAT) |
{{MWST}} |
VAT amount (19%) |
{{GESAMT}} |
Total amount (incl. VAT) |
{{KAUTION}} |
Deposit amount |
{{DATUM_HEUTE}} |
Today's date (DD.MM.YYYY) |
Dependencies
- Gotenberg (docker service
gotenberg) — converts DOCX → PDF via LibreOffice - n8n needs the
jszipnpm package (pre-installed in n8n Docker image)
Domain
All email links and sender addresses use mc-cars.at.