# Text & Output Nodes

Nodes for providing text, formatting output, and logging.

---

## Text Input

Provides a static text value as output. This is the simplest starting point for most workflows — enter text in the configuration panel and it flows to the next node.

**Category:** Text & Output

### Configuration

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| **defaultValue** | String | No | The text value to output |

### Input Ports

| Port | Type | Description |
|------|------|-------------|
| **data** | Mixed | Optional dynamic input that overrides the default value |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **text** | String | The text value |

### Usage

Use Text Input as a starting node when you want to provide a fixed text value. The value set in the configuration panel is used unless data arrives through the `data` input port, which overrides it.

---

## Text Output

Outputs text with optional length limits and format selection.

**Category:** Text & Output

### Input Ports

| Port | Type | Required | Description |
|------|------|----------|-------------|
| **text** | String | Yes | The text to output |

### Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| **maxLength** | Number | (none) | Maximum character length — text will be truncated if exceeded |
| **format** | String | `plain` | Output format: `plain`, `html`, or `markdown` |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **text** | String | The processed text |
| **length** | Number | Character count of the output text |

---

## Prompt Template

Renders a text template with variable substitution using Twig syntax. The most common usage is `{{ variable_name }}` for simple substitution, but the full Twig template language is supported (filters, conditionals, loops, etc.).

**Category:** Text & Output

### Configuration

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| **template** | String | Yes | Twig template text with `{{ variable }}` placeholders |

### Input Ports

| Port | Type | Description |
|------|------|-------------|
| **variables** | Mixed | Dynamic variables that replace template placeholders |

Each `{{ variable_name }}` in the template creates a corresponding input port. Connect data to these ports to substitute values at runtime.

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **prompt** | String | The rendered template with all variables replaced |
| **template** | String | The original template string |
| **variables** | Mixed | The variable values that were substituted |

### Example

Template: `Hello {{ name }}, you have {{ count }} new messages.`

If `name` = "Alice" and `count` = "3", the output is: `Hello Alice, you have 3 new messages.`

Since this uses Twig, you can also use filters and logic:

- `{{ name|upper }}` — Converts to uppercase
- `{{ count + 1 }}` — Arithmetic expressions
- `{% if count > 0 %}You have mail{% endif %}` — Conditionals

---

## Chat Input

Accepts chat messages for interactive workflows in the Playground. Provides the user's message along with conversation history.

**Category:** Text & Output

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **message** | String | The user's message text |
| **history** | Array | Previous messages in the conversation |
| **sessionId** | Number | The session identifier |
| **messageId** | Number | The message identifier |

### Usage

Use Chat Input as the entry point for Playground-based interactive workflows. It automatically receives the user's message when they type in the Playground chat interface.

---

## Chat Output

Outputs messages in the Playground chat interface.

**Category:** Text & Output

### Input Ports

| Port | Type | Required | Description |
|------|------|----------|-------------|
| **message** | String | Yes | The message to display |

### Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| **format** | String | `text` | Output format: `text`, `markdown`, or `html` |
| **showTimestamp** | Boolean | false | Whether to show a timestamp with the message |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **message** | String | The output message |
| **format** | String | The format used |
| **timestamp** | String | Timestamp of the message |

---

## Logger

Writes a message to Drupal's watchdog log. Useful for debugging and audit trails. View logged messages at **Reports > Recent log messages** (`/admin/reports/dblog`).

**Category:** Utility

### Input Ports

| Port | Type | Required | Description |
|------|------|----------|-------------|
| **message** | Mixed | Yes | The message or data to log |

### Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| **level** | String | `info` | Log severity: `emergency`, `alert`, `critical`, `error`, `warning`, `notice`, `info`, `debug` |
| **channel** | String | `flowdrop` | The log channel name |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **message** | Mixed | The logged message (pass-through) |
| **level** | String | The log level used |
| **channel** | String | The log channel used |
| **logged** | Boolean | Whether the message was successfully logged |

---

## Messenger

Displays a Drupal status message to the user (the colored bar at the top of the page).

**Category:** Utility

### Input Ports

| Port | Type | Required | Description |
|------|------|----------|-------------|
| **message** | String | Yes | The message to display |

### Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| **type** | String | `status` | Message type: `status` (green), `warning` (yellow), `error` (red) |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **message** | String | The displayed message |
| **type** | String | The message type |
| **displayed** | Boolean | Whether the message was displayed |
