Skip to Content
DocsLowcodeQuickstartBeispiel-Flows importieren

Beispiel-Flows importieren

Lernen Sie ProcessCube® LowCode am besten durch praktische Beispiele! Diese Seite zeigt Ihnen, wie Sie vorgefertigte Flows importieren und als Startpunkt für eigene Entwicklungen nutzen.

Flows importieren

Methode 1: Über das Menü

  1. Öffnen Sie den Node-RED Editor (http://localhost:1880)
  2. Klicken Sie auf das Menü (☰) oben rechts
  3. Wählen Sie “Import”
  4. Fügen Sie den Flow-JSON-Code ein
  5. Klicken Sie auf “Import”

Methode 2: Drag & Drop

  1. Kopieren Sie den Flow-JSON-Code
  2. Ziehen Sie eine JSON-Datei direkt in den Editor
  3. Flow wird automatisch importiert

Methode 3: Clipboard

  1. Kopieren Sie den Flow-JSON-Code in die Zwischenablage
  2. Drücken Sie Strg+I (Windows/Linux) oder Cmd+I (Mac)
  3. Flow wird automatisch eingefügt

Beispiel 1: Hello World REST-API

Ein einfacher HTTP-Endpunkt, der JSON zurückgibt.

Flow-JSON

[ { "id": "http_in_hello", "type": "http in", "name": "GET /hello", "url": "/hello", "method": "get", "wires": [["template_hello"]] }, { "id": "template_hello", "type": "template", "name": "JSON Response", "template": "{\n \"message\": \"Hello from ProcessCube® LowCode!\",\n \"timestamp\": \"{{timestamp}}\"\n}", "wires": [["http_response_hello"]] }, { "id": "http_response_hello", "type": "http response", "name": "200 OK", "statusCode": "200", "headers": {"Content-Type": "application/json"}, "wires": [] } ]

Verwendung

Nach dem Import und Deploy:

curl http://localhost:1880/hello

Response:

{ "message": "Hello from ProcessCube® LowCode!", "timestamp": "2025-01-15T10:30:00Z" }

Beispiel 2: CRUD-API (Create, Read, Update, Delete)

Eine einfache In-Memory-CRUD-API für Benutzer.

Features

  • GET /users - Alle Benutzer abrufen
  • GET /users/:id - Einzelnen Benutzer abrufen
  • POST /users - Neuen Benutzer erstellen
  • PUT /users/:id - Benutzer aktualisieren
  • DELETE /users/:id - Benutzer löschen

Flow-Beschreibung

Dieser Flow nutzt Context-Storage (flow.set() / flow.get()) als In-Memory-Datenbank.

Hinweis: Der vollständige Flow ist zu lang für diese Seite. Die Kernkonzepte:

// Function Node: Initialisiere Datenbank let users = flow.get("users") || []; flow.set("users", users); // POST /users: Neuen User erstellen let users = flow.get("users") || []; const newUser = { id: Date.now(), name: msg.payload.name, email: msg.payload.email }; users.push(newUser); flow.set("users", users); msg.payload = newUser; msg.statusCode = 201; return msg; // GET /users: Alle Users abrufen const users = flow.get("users") || []; msg.payload = users; return msg; // DELETE /users/:id: User löschen const userId = parseInt(msg.req.params.id); let users = flow.get("users") || []; users = users.filter(u => u.id !== userId); flow.set("users", users); msg.statusCode = 204; return msg;

Beispiel 3: Dashboard mit Form

Ein einfaches Dashboard mit Formular und Daten-Tabelle.

Voraussetzung

Dashboard-2 muss installiert sein:

Menü → Manage palette → Install → @flowfuse/node-red-dashboard

Flow-Komponenten

  1. ui-form: Formular für Name, E-Mail
  2. ui-button: “Submit”-Button
  3. ui-table: Tabelle mit eingegebenen Daten
  4. function: Daten in Context speichern

Ablauf

[ui-form] → [function: add to list] → [ui-table]

Function Node:

// Daten aus Context laden let entries = flow.get("formEntries") || []; // Neuen Eintrag hinzufügen entries.push({ name: msg.payload.name, email: msg.payload.email, timestamp: new Date().toISOString() }); // Speichern flow.set("formEntries", entries); // An Tabelle weitergeben msg.payload = entries; return msg;

Dashboard ansehen

Nach Deploy öffnen Sie:

http://localhost:1880/dashboard

Beispiel 4: ProcessCube® Engine - Prozess starten

Starten Sie einen BPMN-Prozess via HTTP-Request.

Voraussetzungen

  • ProcessCube® Engine läuft (z.B. via Docker)
  • Engine URL konfiguriert (http://engine:8000)
  • Process Model in Engine deployed (z.B. MyProcess_v1)

Flow

[http in: POST /start-process] → [function: prepare payload] → [http request: Engine Start Process] → [function: format response] → [http response]

Function Node: prepare payload

// Engine-Request vorbereiten msg.url = `${env.get("ENGINE_URL")}/api/process-models/MyProcess_v1/start`; msg.method = "POST"; msg.payload = { inputValues: { customerName: msg.payload.customerName, amount: msg.payload.amount } }; msg.headers = { "Content-Type": "application/json" }; return msg;

Function Node: format response

// Response formatieren msg.payload = { success: true, processInstanceId: msg.payload.processInstanceId, message: "Process started successfully" }; return msg;

Testen

curl -X POST http://localhost:1880/start-process \ -H "Content-Type: application/json" \ -d '{"customerName": "Max Mustermann", "amount": 1000}'

Beispiel 5: Engine-Event Handler

Reagieren Sie auf Engine-Events (z.B. “UserTask Created”).

Flow

[engine-event: userTaskCreated] → [function: extract data] → [http request: send notification] → [debug]

Engine-Event Node (Enterprise Image):

// Konfiguration Event Type: "userTaskCreated" Engine URL: ${ENGINE_URL}

Function Node: extract data

// UserTask-Daten extrahieren const userTask = msg.payload; msg.payload = { to: "admin@example.com", subject: "Neue Aufgabe: " + userTask.name, body: `Eine neue Aufgabe wurde erstellt:\n\nName: ${userTask.name}\nProzess: ${userTask.processInstanceId}` }; return msg;

Beispiel 6: E-Mail versenden (Enterprise Image)

Senden Sie E-Mails mit SMTP.

Voraussetzungen

  • Enterprise Docker Image
  • SMTP-Server verfügbar (z.B. Gmail, SendGrid)

Flow

[inject: trigger] → [function: prepare email] → [smtp: send email] → [debug]

Function Node: prepare email

msg.to = "recipient@example.com"; msg.subject = "Test E-Mail von ProcessCube® LowCode"; msg.payload = "Hallo,\n\ndies ist eine Test-E-Mail.\n\nViele Grüße"; return msg;

SMTP Node:

Server: smtp.gmail.com Port: 587 Use TLS: true Username: your-email@gmail.com Password: your-app-password

Beispiel 7: Datenbank-Integration (PostgreSQL)

Lesen und Schreiben in PostgreSQL-Datenbank.

Voraussetzungen

  • PostgreSQL-Datenbank läuft
  • node-red-contrib-postgresql installiert

Flow: Daten lesen

[inject: trigger] → [postgresql: query] → [debug]

PostgreSQL Node:

SELECT id, name, email FROM users WHERE active = true

Flow: Daten schreiben

[http in: POST /users] → [function: prepare insert] → [postgresql: insert] → [http response]

Function Node: prepare insert

msg.query = { text: "INSERT INTO users (name, email) VALUES ($1, $2) RETURNING id", values: [msg.payload.name, msg.payload.email] }; return msg;

Flows aus der Community

Node-RED Flow Library

Durchsuchen Sie die Node-RED Flow Library  nach Tausenden von Community-Flows:

  • MQTT: IoT-Integrationen
  • Telegram: Bot-Entwicklung
  • AWS: Cloud-Integrationen
  • Home Automation: Smart Home

Importieren aus Flow Library

  1. Öffnen Sie flows.nodered.org 
  2. Suchen Sie nach einem Flow (z.B. “telegram bot”)
  3. Kopieren Sie den JSON-Code
  4. Importieren Sie in Ihren Editor

Best Practices

1. Flows testen vor Produktiv-Einsatz

Nutzen Sie separate Tabs für Entwicklung und Produktion:

  • DEV - Entwicklungs-Flows
  • PROD - Produktiv-Flows

2. Environment Variables nutzen

Vermeiden Sie hart-codierte URLs:

// ❌ Schlecht const url = "http://localhost:8000/api"; // ✅ Gut const url = env.get("ENGINE_URL") + "/api";

Setzen Sie Environment Variables in docker-compose.yml:

environment: - ENGINE_URL=http://engine:8000 - AUTHORITY_URL=http://authority:5000

3. Flows dokumentieren

Nutzen Sie comment Nodes, um Flows zu erklären:

[comment: "Dieser Flow startet einen BPMN-Prozess via HTTP-Request"]

4. Error Handling

Verwenden Sie catch Nodes:

[catch] → [function: log error] → [debug: error]

Weitere Ressourcen

Nächste Schritte

Jetzt, da Sie Beispiel-Flows importiert haben:

  1. Konzepte lernen - Verstehen Sie Node-RED und ProcessCube®
  2. Features erkunden - Entdecken Sie Enterprise-Features
  3. Eigene Nodes entwickeln - Erweitern Sie LowCode

Fragen? Besuchen Sie das Node-RED Forum  oder das ProcessCube® Developer Network !