Skip to main content
Configure document templates using the WYSIWYG editor. Access and manage your templates through the Document Templates section in your Project in FlowX Designer.
Document template interface

Generating documents from HTML templates

The Documents plugin simplifies document generation through predefined templates. This guide focuses on generating documents using HTML templates.
Document templates

Before you begin

  1. Verify access permissions: Ensure you have the necessary permissions to manage document templates.
  2. Check Kafka configuration: Confirm that Kafka is properly configured and accessible:
    • The document plugin relies on Kafka for communication between nodes
    • Familiarize yourself with the required Kafka topics (detailed later in this guide)

Creating an HTML template

  1. Access the WYSIWYG editor through FlowX Designer β†’ Plugins β†’ Document templates
  2. Create or import your HTML template
HTML template creation
For detailed template management instructions:

Managing HTML templates

For comprehensive guidance, take our FlowX.AI Academy course: Creating a Document Template in Designer.

Implementing document generation in a process

Let’s build a document generation flow that creates personalized documents based on user input:
Document generation process example

Step 1: Create a user input form

  1. Add a User Task node to your process
  2. Configure UI elements to collect the information needed for your document:
    • Input fields (text, numbers, dates, etc.)
    • Make sure to set appropriate keys for each field that match your template variables

Step 2: Configure the document generation request

  1. Add a Send Message Task (Kafka) node
  2. Configure the Kafka send action with the appropriate topic:
    • For HTML template generation, use ai.flowx.plugin.document.trigger.generate.html.v1 (or your configured equivalent, set via KAFKA_TOPIC_DOCUMENT_GENERATE_HTML_IN)
Kafka send action
To find your environment’s configured topics:
  1. Navigate to FlowX Designer β†’ Platform Status
  2. Find the document-plugin-mngt component and click the eye icon
  3. Expand KafkaTopicsHealthCheckIndicator β†’ details β†’ configuration β†’ topic β†’ document β†’ generate
  4. Look under HTML and PDF sections for your in/out topics
Kafka topics for document generation
  1. Create the request payload with the following structure:
Kafka send action
Key parameters:
  • customId: Folder name where the file will be saved
  • templateName: Name of the template defined in Document templates
  • language: Must match the language configured on the template
  • data: Key-value pairs mapping template variables to process data
  • includeBarcode: Set to true if you need a barcode on the document
When using templates in a process, the system uses default values from the default project language. For example, if English is your default project language, the template will use values from the English version.To check your default language: FlowX Designer β†’ Project Settings β†’ Languages

Step 3: Receive the generated document

  1. Add a Receive Message Task (Kafka) node
  2. Configure it with:
    • The response topic: ai.flowx.engine.receive.plugin.document.generate.html.results.v1 (or your configured equivalent, set via KAFKA_TOPIC_DOCUMENT_GENERATE_HTML_OUT)
    • Key for storing the response: generatedDocuments
Receive message configuration
The response contains information about the generated documents:
HTML generation response
Sample response structure:
Response fields:
  • fileId: Unique identifier for the generated file
  • documentType: Template name used for generation
  • minioPath: Storage location (MinIO or S3)
  • downloadPath: URL path for downloading the file
  • noOfPages: Document page count
  • error: Error information (null if successful)

Error responses

When generation fails, error is populated as an object with three fields: The error appears at one of two levels, never both:
  • Request-level (error at the root): the whole request was rejected before any document was processed, for example a malformed payload or an empty documentList. generatedFiles is not populated.
  • Per-document (error inside a generatedFiles entry): that document failed while the rest of the request proceeded. A missing template or failed input validation returns 400; a rendering or storage failure returns 500. Other documents in the same response can still succeed, so check the error field of each entry. The root error stays null in this case.
In the process, branch on the received error fields before using downloadPath: a failed document has fileId and downloadPath set to null, so wiring the happy path only leaves the user with a broken file preview when generation fails.

Displaying the generated document

To display the generated document to the user:
  1. Add a Task Node to extract the document path from the response
  2. Add a User Task with the Document Preview UI Element:
    • Configure the element with the download path from the previous node
For detailed instructions on displaying documents, see:

Uploading a new document

Last modified on September 14, 2026