Examples

Rendering data with handlebars

Using Handlebars inside Node properties

Some node properties support Handlebars. For example, the message text of the message node.

Handlebars lets you insert dynamic state data directly into a node’s message content. In practice, you write templates like {{text}} and the builder replaces them with values from the node’s state at runtime.

How data reaches your Message Node

In this example:

  • A Text Node produces a value (e.g. "Cat")
  • A Number Node produces a value (e.g. 42)
  • A Message Node receives both values via push edges

Those edges push the incoming values into the Message Node’s state, so the Message Node can render them immediately.

Basic example: print values in a Message Node

Put this directly into your Message Node:

Your text: {{text}}
Your number: {{number}}

After the edges have delivered the values, your Message Node state might look like this (some fields are created by the Message Node itself, others were pushed in):

{
  "sent": true,
  "arrived": true,
  "text": "Cat",
  "number": 42
}

Inspecting state: what can you use in Handlebars?

You can inspect a node’s current state anytime by selecting the node in the builder. This is the easiest way to decide which variables are available for your templates (for example text, number, sent, arrived, etc.).


Common Handlebars patterns you can use

1) Conditional text with if / else

{{#if text}}
You entered: {{text}}
{{else}}
Please provide a text value.
{{/if}}

2) Comparisons (greater than, less than, equal)

Greater than

{{#if (gt number 10)}}
Big number: {{number}}
{{else}}
Small number: {{number}}
{{/if}}

Less than

{{#if (lt number 10)}}
Small number: {{number}}
{{else}}
Big number: {{number}}
{{/if}}

Equal

{{#if (eq text "Cat")}}
Meow. 🐾
{{else}}
You typed: {{text}}
{{/if}}

3) Range checks (between)

Useful for scoring, ages, levels, budgets, etc.:

{{#if (between number 1 5 true)}}
Rating accepted (1–5): {{number}}
{{else}}
Rating must be between 1 and 5.
{{/if}}

(In this example, true means “inclusive”, so 1 and 5 are allowed.)