Docs / Strand / templating/overview
Templating & Data Passing Overview
Strand supports two powerful templating systems for accessing and transforming data in workflows.
Overview#
Jinja2 excels at string building and logic, while JSONPath is perfect for querying complex data structures. Use them together for maximum flexibility!
Jinja2#
A full-featured templating engine perfect for:
- Building strings (URLs, messages, JSON)
- Conditional logic and branching
- Loops and control flow
- String manipulation and formatting
JSONPath#
A query language ideal for:
- Extracting data from complex JSON structures
- Filtering arrays based on conditions
- Using built-in functions (
len,keys,str, etc.) - Arithmetic operations on extracted values
Using Both Together#
You can use Jinja2 and JSONPath together in the same template:
{{ payload | jsonpath('$.users[?(@.active == true)]') | length }} active users
{% set active_users = payload | jsonpath('$.users[?(@.active == true)]') %}
{% if active_users | length > 10 %}
{{ 'Many active users: ' + (active_users | length | string) }}
{% else %}
{{ 'Few active users: ' + (active_users | length | string) }}
{% endif %}
Accessing Data#
Current Event#
| Variable | Description |
|---|---|
payload |
Current event payload - automatically contains the previous node's output when directly connected |
meta |
Current event metadata |
event |
Full current event object |
When nodes are directly connected, the previous node's output is automatically available as payload. No need to use steps.{node_id}.output_payload for direct connections!
Previous Steps#
| Variable | Description |
|---|---|
steps.{node_id}.output_payload |
Output payload from a specific step |
steps.{node_id}.output_meta |
Metadata from a step |
steps.{node_id}.output |
Full output array (all events) |
steps.{node_id}.output_count |
Number of output events |
Replace {node_id} with the actual node ID from your workflow. You can find the node ID in the Node Inspector when you select a node.
Initial Event#
| Variable | Description |
|---|---|
initial |
Original workflow input (before any processing) |
Workflow Variables#
| Variable | Description |
|---|---|
variables.{key} |
Workflow-specific values stored in Workflow Variables (plain text) |
Global Vault#
| Variable | Description | Available In |
|---|---|---|
vault.{key} |
Encrypted sensitive values stored in the Global Vault (shared across all workflows) | All node types |
Vault secrets are accessible across all workflow node types: Jinja templates use {{ vault.key }}, Python snippets and functions use vault['key'] or vault.get('key').
Vault values are never stored or displayed as plain text. In all run logs, step outputs, and print output, they are automatically replaced with their {{ vault.key_name }} placeholder.
Use identifier-safe keys (letters, digits, underscores) so {{ vault.key }} dot access works. For keys with hyphens, spaces, or a leading digit, use bracket access: {{ vault['api-token'] }}.
Example:
# Any Jinja template context (HTTP headers, transforms, conditions, etc.)
"Authorization": "Bearer {{ vault.api_token }}"
- Workflow Variables: Non-sensitive configuration (API URLs, timeouts, environment settings), accessed via
{{ variables.key }} - Global Vault: Sensitive secrets (API tokens, passwords, credentials), accessed via
{{ vault.key }}
See the Global Vault guide for details.
Quick Examples#
Simple Field Access#
{{ payload.user_id }}
Previous Step Output#
For directly connected nodes, use payload:
{{ payload.email }}
For non-direct access, use step references:
{{ steps.user_lookup.output_payload.email }}
JSONPath Extraction#
{{ payload | jsonpath('$.items[*].id') }}
Conditional Logic#
{{ 'admin' if payload.role == 'admin' else 'user' }}
Node IDs are generated (node_a1b2c3d4) and cannot be renamed. Copy the exact expression from the node inspector's Data access reference, and use node labels to keep the canvas readable.
Learn More#
- Jinja2 Syntax - Complete Jinja2 guide with examples
- JSONPath - JSONPath features and built-in functions
- Passing Data Between Steps - Detailed examples and patterns
- Nested Workflows - Calling workflows from workflows
- Global Vault - Secure encrypted storage for sensitive values
Tendrl