Skip to content

List to Text

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.

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:

FilterEffectExample
trimRemoves leading and trailing spaces{{item.name|trim}}
upper / lowerUpper / lower case{{item.country|upper}}
fixed:NNumber with N decimals{{item.total|fixed:2}} → 12.50
dateDate YYYY-MM-DD{{item.created|date}}
truncate:NCuts to N characters{{item.title|truncate:40}}
default:textText 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.

ParameterTypeRequiredDescription
sourcetextNoPath to the list (for example orders or data.items). Empty = uses data
modeselectYestext (one line per item), htmlList (HTML list) or htmlTable (HTML table)
rowTemplatetextareaDepends on formatRow template (Text and HTML list). Example: - {{item.name}}: {{item.total|fixed:2}}
escapeHtmlbooleanNoIn 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
columnstextDepends on formatTable columns (HTML table only): field or field:Title, comma-separated
separatortextNoSeparator between rows (Text only). Empty = new line. \n = new line
headertextareaNoText before the list; only added when there are items
footertextareaNoText after the list; only added when there are items
emptyTexttextNoResult when the list is empty
maxItemsnumberNoMaximum items to show. Empty or 0 = all
moreTexttextNoText at the end when the list was cut; {{remaining}} = how many are left. Example: … and {{remaining}} more
outputKeytextNoName of the result field (default text)

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.

{
"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}}.

{
"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.