See llms.txt for all machine-readable content.

Back to Templates

Generate business-process digital twins with PostgreSQL and event streams

Quick overview

This workflow exposes a webhook that accepts a business process definition (inline or by URL) and orchestrates API calls to design a “digital twin” package, including a PostgreSQL schema, event-stream configuration, and an n8n sync-workflow JSON, then returns the assembled package in the HTTP response.

How it works

  1. Receives a POST request via a webhook containing either a processUrl or an inline processDefinition plus configuration like twinName, processType, and eventBackend.
  2. Validates the payload and immediately returns an HTTP 400 response with error details if neither a URL nor an inline definition is provided.
  3. Calls an external HTTP endpoint to fetch the process definition when a URL is supplied.
  4. Calls an external HTTP endpoint for AI-driven digital-twin design to produce a state model, event taxonomy, and sync logic.
  5. Calls external HTTP endpoints to generate/validate PostgreSQL DDL, configure event-stream topics/consumers, and store the generated twin definition in a catalog.
  6. Assembles a final deliverable (documentation, PostgreSQL schema structure, event-stream config, and an n8n event-sync workflow JSON) and returns it to the caller with an HTTP 200 or 207 status.

Setup

  1. Replace the demo httpbin.org URLs in the validation/config step with your real endpoints for process fetching, AI twin design, PostgreSQL schema generation, event-stream registration, and catalog storage.
  2. If you plan to execute the generated schema and run the generated sync workflow, prepare PostgreSQL credentials and an event-stream platform connection (for example Kafka/NATS/Redis Streams) in your environment.
  3. Copy the production webhook URL from n8n and configure your source system to POST the process payload to /webhook/bp-digital-twin with either processUrl or processDefinition.