Ripple
All guides

Nunjucks templating

Use Nunjucks conditionals, loops, and filters in request URLs, headers, and bodies when plain {{variable}} substitution is not enough.

Jump to section

When Nunjucks runs

Ripple uses the Nunjucks engine when a field contains logic blocks ({% if %}, {% for %}), filters ({{ name | upper }}), or comments ({# #}).

Nunjucks {% %} templates are desktop-only — not supported in rip CLI.

  • Plain {{host}} placeholders keep the fast simple substitution path
  • Existing collections behave the same unless you add Nunjucks syntax
  • Runs at send time with the same variable resolution order as simple interpolation
  • Chain runtime overrides still apply on top of global → collection → environment

Variable types in templates

Environment and collection values are stored as strings. Ripple coerces them for Nunjucks when useful:

Store JSON arrays/objects as a single variable value when you need {% for item in items %} loops.

Stored valueBecomes in template
true / falseboolean
42, 3.14number
["a","b"]JSON array
{"id":1}JSON object
anything elsestring

Dynamic variables in Nunjucks

Postman-style dynamic variables work inside Nunjucks templates and are resolved before rendering:

{"requestId": "{{ $guid }}", "ts": {{ $timestamp }}}

Filters

Set tags to ["api","v2"] (JSON array string) to get api, v2 from join.

Authorization: Bearer {{ apiToken | trim }}
X-Label: {{ env | upper }}
X-Tags: {{ tags | join(", ") }}

Conditional URL

{% if env == "prod" %}https://api.example.com{% else %}https://staging.example.com{% endif %}/v1/users

Loop-built JSON body

Set ids to [1, 2, 3] as a JSON array variable.

[
{% for id in ids %}
  "{{ id }}"{% if not loop.last %},{% endif %}
{% endfor %}
]

JSON request bodies

{
  "env": "{{ env }}",
  "count": {{ count }},
  "active": {{ enabled }}
}

Simple {{var}} only

  • Values inside quoted JSON strings are escaped automatically (quotes, newlines, etc.)

Nunjucks logic or filters

  • The entire body is rendered as one template — you are responsible for valid JSON

Supported Nunjucks features

Not supported: template inheritance ({% extends %}), includes ({% include %}), macros, or file-based templates — only inline strings in request fields.

FeatureExample
Output{{ variable }}
Filters{{ name | upper }}, {{ items | join(",") }}, {{ x | default("n/a") }}
Conditionals{% if %}, {% elif %}, {% else %}, {% endif %}
Loops{% for item in list %}, loop.first, loop.last, loop.index
Comments{# not sent #}
Whitespace control{%- and -%} (trim blocks enabled)

Unresolved variables & errors

  • Simple {{var}}: unknown names stay as literal {{var}} in output
  • Nunjucks: unknown names render empty unless you use | default(...)
  • Ripple warns in the UI when a referenced variable is not defined
  • Syntax errors are logged; original template text is left unchanged

Where it works

  • Request URL and query params
  • Header names and values
  • Body (JSON, raw, form, GraphQL query/variables, SOAP)
  • Auth fields resolved through variables
  • Request chains (each step's URL, headers, body)