Login
Free Sign Up
Docs
/

Text - Template

Type identifier: text:template Category: Text Operations

Description

Renders a rich-content template with variable substitution. Insert variables through the template editor, then connect each generated input handle to the value it should render. It generates dynamic content such as messages, emails, or prompts.

Input Handles

Handle

Data Type

Required

Description

{variableName}

Varies

Varies

Dynamic handles for each variable

Input Handle Details

Variable Handles

Input handles are dynamically generated based on the variables configuration:

  • Handle ID: The variable name from the variables array
  • Type: Any (such as strings, numbers, and content)
  • Notes:

    • Media URLs in content values are signed while the node renders
    • All variable values are serialised into the template

Output Handles

Handle

Data Type

Description

result

string

The rendered template

error

trigger

Triggered on rendering error

Output Handle Details

result

  • Type: string
  • Notes:

    • Variables are substituted into the template
    • Content format is serialised to string

Configuration Options

Property

Type

Required

Default

Description

label

string

Yes

"Text - Template"

Display label for the node

variables

string[]

Yes

[]

Variable names to substitute

template

Content

Yes

Empty paragraph

The rich-content template

Configuration Details

variables

  • Type: string[]
  • Notes:

    • Each variable name creates an input handle
    • Insert the corresponding variable into the template with the editor
    • Case-sensitive matching

template

  • Type: Content
  • Notes:

    • Variables are embedded as variable nodes in the content structure
    • Images, files, and other content media are signed while rendering

Behaviour

Execution Flow

  1. Resolves all variable values from input handles
  2. Signs any file URLs in the template or content-valued variables while rendering
  3. Serialises the template with variables substituted
  4. Returns rendered string

Variable Substitution

Variable Type

Behaviour

String

Inserted directly

Date string

Formatted using the variable's format or field default

Number

Converted to string

Content

Serialised to text, files pre-signed

Object

JSON serialised

Array

JSON serialised

Date Variable Formatting

When a variable value is a parseable date/datetime string (ISO 8601 or Temporal ZonedDateTime format), it is automatically formatted using the format cascade:

  1. Variable-level format — if the variable reference in the template content specifies a format
  2. Field-level defaultFormat — from the Schema field's configuration (when Schema context is available)
  3. ISO fallback — raw string value if no format is configured

The viewer's timezone preference is used when timezoneDisplay is set to "viewer" on the Schema field.

Content Handling

  • Media nodes (images, audio, video) have URLs pre-signed
  • Content structure is serialised to plain text
  • Nested content is flattened

Error Handling

Scenario

Behaviour

A file URL cannot be signed or accessed

Triggers error with a generic file error

Rendering fails

Triggers error

Examples

Greeting Template

{
  "type": "text:template",
  "data": {
    "label": "Greeting Message",
    "variables": ["name", "company"],
    "template": [
      {
        "type": "paragraph",
        "children": [
          { "text": "Hello " },
          { "type": "variable", "variable": "name", "children": [{ "text": "" }] },
          { "text": ", welcome to " },
          { "type": "variable", "variable": "company", "children": [{ "text": "" }] },
          { "text": "!" }
        ]
      }
    ]
  }
}

Email Template

{
  "type": "text:template",
  "data": {
    "label": "Order Confirmation",
    "variables": ["customerName", "orderId", "total"],
    "template": [
      {
        "type": "paragraph",
        "children": [
          { "text": "Dear " },
          { "type": "variable", "variable": "customerName", "children": [{ "text": "" }] },
          { "text": ", your order #" },
          { "type": "variable", "variable": "orderId", "children": [{ "text": "" }] },
          { "text": " has been confirmed. Total: $" },
          { "type": "variable", "variable": "total", "children": [{ "text": "" }] }
        ]
      }
    ]
  }
}

Rich Content Template

{
  "type": "text:template",
  "data": {
    "label": "Report Summary",
    "variables": ["title", "content"],
    "template": [
      {
        "type": "heading",
        "level": 1,
        "children": [{ "type": "variable", "variable": "title", "children": [{ "text": "" }] }]
      },
      {
        "type": "paragraph",
        "children": [{ "type": "variable", "variable": "content", "children": [{ "text": "" }] }]
      }
    ]
  }
}

LLM Prompt Template

{
  "type": "text:template",
  "data": {
    "label": "Analysis Prompt",
    "variables": ["document", "question"],
    "template": [
      { "type": "paragraph", "children": [{ "text": "Based on the following document:" }] },
      {
        "type": "paragraph",
        "children": [{ "type": "variable", "variable": "document", "children": [{ "text": "" }] }]
      },
      { "type": "paragraph", "children": [{ "text": "Please answer this question:" }] },
      {
        "type": "paragraph",
        "children": [{ "type": "variable", "variable": "question", "children": [{ "text": "" }] }]
      }
    ]
  }
}

Related pages