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 value | Becomes in template |
|---|---|
| true / false | boolean |
| 42, 3.14 | number |
| ["a","b"] | JSON array |
| {"id":1} | JSON object |
| anything else | string |
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/usersLoop-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.
| Feature | Example |
|---|---|
| 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)