n8n-nodes-erp-clinic
v1.5.2
Published
n8n community node — visual customer segmentation builder for clinic ERPs. Generates SQL queries from visual rules (appointments, services, budgets, plans).
Maintainers
Readme
n8n-nodes-erp-clinic
n8n Community Node — Visual customer segmentation builder for clinic ERPs.
Build rules visually and get a ready-to-run SQL query as output.
Installation
Via n8n UI (self-hosted)
- Go to Settings → Community Nodes
- Click Install
- Enter
n8n-nodes-erp-clinic - Confirm and restart
Via CLI
npm install n8n-nodes-erp-clinic
# restart n8nHow it works
Search for "ERP Clinic — Customer Segmentation" in the node panel.
- Set the root operator: ALL (AND) or ANY (OR)
- Click Add Condition and configure each rule
- The node outputs
{ "sql": "SELECT ..." }— pipe it directly into a Postgres or MySQL node
Available conditions
📅 Agenda (Appointments)
| Field | Operators | Value | |---|---|---| | Has future appointment | — | Yes / No | | Has any appointment | — | Yes / No | | Appointment status | is, is not, is any of | scheduled / confirmed / completed / canceled / no_show | | Appointment service SKU | equals, is any of | SKU string(s) | | Days since last appointment | = ≠ > ≥ < ≤ | number | | No-show count | = ≠ > ≥ < ≤ | number |
💉 Serviço (Services)
| Field | Operators | Value | |---|---|---| | Has purchased any service | — | Yes / No | | Service SKU | equals, is any of | SKU string(s) | | Days since last service | = ≠ > ≥ < ≤ | number | | Total services purchased | = ≠ > ≥ < ≤ | number | | Total amount spent (R$) | = ≠ > ≥ < ≤ | number |
Only considers orders with
status = 'paid'
📋 Orçamento (Budgets)
| Field | Operators | Value | |---|---|---| | Has open budget | — | Yes / No | | Budget status | is, is not, is any of | open / converted / expired | | Budget total amount (R$) | = ≠ > ≥ < ≤ | number | | Days without conversion | = ≠ > ≥ < ≤ | number | | Is recent budget (≤ 7 days) | — | Yes / No | | Budget service SKU | equals, is any of | SKU string(s) |
🏷️ Plano (Plans)
| Field | Operators | Value | |---|---|---| | Has any plan | — | Yes / No | | Has active plan | — | Yes / No | | Plan status | is, is not, is any of | active / canceled / expired | | Plan SKU | equals, is any of | SKU string(s) | | Days until plan expires | = ≠ > ≥ < ≤ | number |
Example output
Setup: Customers who bought Botox AND have no future appointment
Match: ALL conditions (AND)
├─ Serviço │ Service SKU │ equals │ botox_001
└─ Agenda │ Has future appoint. │ — │ NoGenerated SQL:
SELECT
c.id,
c.name,
c.created_at
FROM customers c
WHERE
(
EXISTS (
SELECT 1 FROM orders o
JOIN order_items oi ON oi.order_id = o.id
JOIN services s ON s.id = oi.service_id
WHERE o.customer_id = c.id
AND o.status = 'paid'
AND s.sku = 'botox_001'
)
)
AND (
NOT EXISTS (SELECT 1 FROM appointments a WHERE a.customer_id = c.id AND a.start_at > NOW())
)
ORDER BY c.name;Expected database schema
customers id, name, created_at
appointments id, customer_id, service_id, start_at, status
services id, sku, name
orders id, customer_id, status, created_at, total_amount
order_items id, order_id, service_id, quantity, unit_price
budgets id, customer_id, status, created_at, converted_at, total_amount
budget_items id, budget_id, service_id, quantity, unit_price
customer_plans id, customer_id, plan_id, status, start_at, end_at
plans id, sku, nameLicense
MIT
