List to Text
Description
Section titled “Description”The List to Text node turns a list (for example the orders of a shop or the rows of a sheet) into text ready for a Slack or Telegram message, an email or a report. It replaces the classic script that looped over the list and built the text by hand.
It has three formats:
- Text: one line per item, from a template you write.
- HTML list: the same template, inside
<ul><li>…</li></ul>. - HTML table: a table with the columns you choose.
If you don’t set source, the node uses the list coming from the previous node. If the input is an object with an items or data property that is a list, it uses that automatically.
Row template
Section titled “Row template”In the template, each item’s data is written as {{item.field}} (paths like {{item.customer.name}} work). {{item._n}} is the row number, starting at 1.
You can give alternatives with ||: the first one that has a value is used, for example {{item.customer.name || item.customer.email}}. Filters go at the end and apply to the chosen alternative.
You can apply filters with |, and chain them:
| Filter | Effect | Example |
|---|---|---|
trim | Removes leading and trailing spaces | {{item.name|trim}} |
upper / lower | Upper / lower case | {{item.country|upper}} |
fixed:N | Number with N decimals | {{item.total|fixed:2}} → 12.50 |
date | Date YYYY-MM-DD | {{item.created|date}} |
truncate:N | Cuts to N characters | {{item.title|truncate:40}} |
default:text | Text if the value is empty | {{item.customer|default:no name}} |
In the HTML formats, values are escaped automatically (a name like Ana <b> won’t break the HTML); the template itself is kept as written.
Configuration
Section titled “Configuration”Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| source | text | No | Path to the list (for example orders or data.items). Empty = uses data |
| mode | select | Yes | text (one line per item), htmlList (HTML list) or htmlTable (HTML table) |
| rowTemplate | textarea | Depends on format | Row template (Text and HTML list). Example: - {{item.name}}: {{item.total|fixed:2}} |
| escapeHtml | boolean | No | In Text format, escapes <, > and & in values. Turn it on when the row template has its own HTML (<tr><td>…). HTML list and table always escape |
| columns | text | Depends on format | Table columns (HTML table only): field or field:Title, comma-separated |
| separator | text | No | Separator between rows (Text only). Empty = new line. \n = new line |
| header | textarea | No | Text before the list; only added when there are items |
| footer | textarea | No | Text after the list; only added when there are items |
| emptyText | text | No | Result when the list is empty |
| maxItems | number | No | Maximum items to show. Empty or 0 = all |
| moreText | text | No | Text at the end when the list was cut; {{remaining}} = how many are left. Example: … and {{remaining}} more |
| outputKey | text | No | Name of the result field (default text) |
Output
Section titled “Output”The node keeps the data that was already there (if the previous node returned an object) and adds:
{ "text": "Today's orders:\n- A-1: 12.50 (Ana)\n- A-2: 7.00 (no name)\n… and 1 more", "count": 3, "shown": 2, "empty": false}count is the total number of items, shown how many appear in the text, and empty tells whether the list was empty (handy for a later decision node).
If the input is not a list, the template is missing, an unknown filter is used or a table has no columns, the node returns an error explaining it.
Usage Examples
Section titled “Usage Examples”Orders alert with a limit
Section titled “Orders alert with a limit”{ "label": "Alert text", "source": "orders", "mode": "text", "rowTemplate": "- {{item.reference}}: {{item.total|fixed:2}} ({{item.customer|default:no name}})", "header": "High-value orders:", "emptyText": "No high-value orders", "maxItems": 10, "moreText": "… and {{remaining}} more", "outputKey": "message"}A Slack or Telegram node can then send {{message}}.
Table for an email
Section titled “Table for an email”{ "label": "Sales table", "source": "sales", "mode": "htmlTable", "columns": "product:Product, units:Units, total:Amount", "outputKey": "table"}The table field holds the <table>…</table> ready for an email’s HTML body.