n8n is de centrale workflow engine in PMA. Het verbindt services, automatiseert processen en orchestreert cross-service integraties.
n8n biedt:
- Visual Editor - Low-code workflow builder
- 400+ Integrations - Pre-built nodes
- Custom Code - JavaScript/Python support
- Webhooks - Event-driven triggers
- Self-hosted - Volledige data controle
graph TB
subgraph "Triggers"
WH["Webhooks"]
SC["Schedule"]
EV["Events"]
end
subgraph "n8n Workflows"
W1["Zammad -> Mattermost"]
W2["Monitoring Alerts"]
W3["User Onboarding"]
W4["Backup Jobs"]
end
subgraph "Services"
ZM["Zammad"]
MM["Mattermost"]
GR["Grafana"]
AU["Authentik"]
end
WH --> W1 & W2 & W3
SC --> W4
EV --> W1
W1 --> ZM & MM
W2 --> GR & MM
W3 --> AU
W4 --> ZM & GR
style WH fill:#2563eb,color:#fff
style SC fill:#2563eb,color:#fff
style EV fill:#2563eb,color:#fff
style W1 fill:#059669,color:#fff
style W2 fill:#059669,color:#fff
style W3 fill:#059669,color:#fff
style W4 fill:#059669,color:#fff
style ZM fill:#d97706,color:#fff
style MM fill:#d97706,color:#fff
style GR fill:#d97706,color:#fff
style AU fill:#d97706,color:#fff
flowchart LR
subgraph "Trigger"
T["Webhook/Schedule"]
end
subgraph "Process"
N1["Fetch Data"]
N2["Transform"]
N3["Validate"]
end
subgraph "Action"
A1["Create Record"]
A2["Send Notification"]
A3["Update Status"]
end
subgraph "Error Handling"
E["Error Workflow"]
end
T --> N1
N1 --> N2
N2 --> N3
N3 --> A1 & A2 & A3
N1 & N2 & N3 -.->|"on error"| E
style T fill:#2563eb,color:#fff
style N1 fill:#059669,color:#fff
style N2 fill:#059669,color:#fff
style N3 fill:#059669,color:#fff
style A1 fill:#7b2cbf,color:#fff
style A2 fill:#7b2cbf,color:#fff
style A3 fill:#7b2cbf,color:#fff
style E fill:#d97706,color:#fff
Reageren op externe events:
| Trigger |
Voorbeeld |
| Webhook |
Zammad ticket created |
| API Poll |
Check for new issues |
| Database |
Row inserted |
Periodieke taken:
| Schedule |
Voorbeeld |
0 * * * * |
Hourly health check |
0 2 * * * |
Daily backup |
0 9 * * 1 |
Weekly report |
On-demand uitvoering:
# Trigger via CLI
just n8n-trigger workflow-name
# Via API
curl -X POST http://localhost:5678/webhook/workflow-id
sequenceDiagram
participant Z as Zammad
participant N as n8n
participant M as Mattermost
Z->>N: 1. Ticket webhook
N->>N: 2. Parse ticket data
N->>N: 3. Format message
N->>M: 4. Post to channel
M-->>N: 5. Confirmation
Use case: Nieuwe Zammad tickets posten in team channel.
sequenceDiagram
participant G as Grafana
participant N as n8n
participant P as PagerDuty
G->>N: 1. Alert webhook
N->>N: 2. Check severity
N->>N: 3. Enrich context
N->>P: 4. Create incident
P-->>N: 5. Incident ID
Use case: Critical alerts escaleren naar on-call.
sequenceDiagram
participant A as Authentik
participant N as n8n
participant Z as Zammad
participant M as Mattermost
A->>N: 1. User created
N->>Z: 2. Create agent
N->>M: 3. Invite to team
N->>N: 4. Send welcome email
Use case: Automatische service provisioning voor nieuwe users.
- Error handling - Altijd error workflow configureren
- Idempotency - Workflows moeten herhaalbaar zijn
- Logging - Log belangrijke stappen
- Testing - Test met sample data eerst
- Documentation - Beschrijf doel en dependencies
# Start n8n
just start n8n
# Open editor
xdg-open http://localhost:5678
# Export workflow
just n8n-export my-workflow
# Import workflow
just n8n-import workflow.json
# Backup all workflows
just n8n-backup
n8n slaat credentials encrypted op:
graph LR
subgraph "Credential Types"
API["API Keys"]
OAUTH["OAuth2"]
BASIC["Basic Auth"]
end
subgraph "Storage"
ENC["Encrypted DB"]
end
subgraph "Usage"
WF["Workflows"]
end
API & OAUTH & BASIC --> ENC
ENC --> WF
style API fill:#2563eb,color:#fff
style OAUTH fill:#2563eb,color:#fff
style BASIC fill:#2563eb,color:#fff
style ENC fill:#d97706,color:#fff
style WF fill:#059669,color:#fff
# Credentials worden beheerd via UI
http://localhost:5678/credentials
# Of via environment
N8N_CREDENTIALS_OVERWRITE_DATA='{"api": {"key": "xxx"}}'
# Recent executions
curl http://localhost:5678/api/v1/executions
# Failed executions
curl "http://localhost:5678/api/v1/executions?status=error"
n8n exposeert Prometheus metrics:
http://localhost:5678/metrics
¶ Commands Reference
# Workflow management
just n8n-start # Start n8n
just n8n-stop # Stop n8n
just n8n-logs # View logs
# Workflow operations
just n8n-export NAME # Export workflow
just n8n-import FILE # Import workflow
just n8n-backup # Backup all workflows
# Triggering
just n8n-trigger NAME # Manual trigger