Skip to main content

Template Filters

Gravity Rail templates are rendered with Jinja2, so every standard Jinja2 filter is available — upper, lower, title, capitalize, trim, default, length, join, replace, truncate, int, float, round, sum, min, max, urlencode, and more. Use them with the pipe (|) syntax: {{ value | filter }}.

On top of those, Gravity Rail adds a few custom filters tailored for member data.

oxford_join — format a list with Oxford commas​

Turns a list of values into a grammatically natural English phrase.

InputOutput
['apple']apple
['apple', 'pear']apple and pear
['apple', 'pear', 'plum']apple, pear, and plum
Today we discussed {{ member.data.visit.topics | oxford_join }}.

date — format dates and timestamps​

Reformats a date, time, or datetime value. Default output is YYYY-MM-DD; pass any strftime format string to customize.

{{ record.created_at | date }}                    → 2026-04-15
{{ record.created_at | date('%d/%m/%Y') }} → 15/04/2026
{{ record.created_at | date('%B %d, %Y') }} → April 15, 2026
{{ member.date_of_birth | date('%b %d') }} → Apr 15

If the input can't be parsed as a date, the original value is returned unchanged. Empty or missing values render as "".

Wrap the destination's public Site URL to give the message recipient a one-time automatic login, with ordinary Site login as the fallback:

Hi {{member.first_name}} — please review your options at
{{ "https://care--example.gravityrailsites.com/en-US/intake" | site_autologin_link }}

Use the URL shown in the workspace's Sites list: a source Site under *.gravityrailsites.com, a themed Site under *.sites.gravityrail.com, or a verified mapped domain. The destination must resolve to a Site in the sending workspace. Use an absolute URL; a relative path does not identify the Site.

How it works:

  • Outbound SMS/WhatsApp action message bodies, email action subjects and bodies, and the Send SMS tool can mint a fresh credential for the actual recipient. The recipient must be an active Member linked to an Account, and the delivery address must match that Account's email or phone for the channel used.
  • The credential expires after 15 minutes and can be redeemed once. It signs the recipient into that Site's origin and workspace using their existing permissions. It does not create an Account, grant a role, or select a Form or Workflow.
  • Expired or already-used credentials, accounts requiring MFA, and recipients who cannot receive an automatic login use the ordinary Site login screen. After login, they return to the requested page.
  • Preview renders and rendering contexts without a verified delivery recipient produce an ordinary login link, without issuing a credential. This includes initialUserMessage Workflow seeds and the Assistant Message action.
  • The filter replaces an existing site_autologin query parameter and preserves the rest of the URL. Invalid URL syntax renders empty. Configure attribution parameters on the destination URL as needed.
  • A Site on the shared path-based development host cannot receive a per-Site credential, because that host serves every Site from one origin. Links to one use the ordinary Site login screen instead. On dev-cloud this applies to managed-theme Sites; source Sites there have a host of their own.

These links authenticate the recipient. Do not forward them or reuse a rendered message for a different Member. Configure access to the destination's Forms, Workflows, and data through their normal permission settings.

Choose the destination Site explicitly by its workspace-local slug:

{{ 'enrollment-site' | site_url }}

The filter resolves the Site's current public URL from its workspace-local slug. It issues no credential. A missing Site fails the send. Authentication methods and Form bindings are configured on the Site. A2P Brand selection does not choose the destination.

site_setting — show a Site's setting​

Show a setting the workspace chose for one of its Sites, such as its logo and practice name. Name the Site by its slug and the setting by its key, both in quotes:

<img src="{{ 'enrollment-site' | site_setting('practice_logo') }}"
alt="{{ 'enrollment-site' | site_setting('practice_name') }}">
  • A text-like setting (text, long text, number, choice, URL, colour, yes/no) prints what the Site saved, or the theme's default, or nothing when neither is set.
  • An image setting prints the image's address. In an email, an <img> whose src is the tag is embedded in the email, like an image inserted from Files. The image must be one the Site itself can show: an image file, already public. Insert it with Insert Variable, which lists the image and text settings of each Site built on a Gravity Rail theme to Members who can view Sites (a Site built from your own source files is not listed; type its setting's key). The email editor inserts an image setting as an image; text editors list only text settings.
  • Copied into another workspace, for example by installing a Bundle, the same tag shows that workspace's own Site setting.

When the setting cannot be used, a message that prints it is not sent, and the send records why: site_image_unset (no image chosen), site_image_not_public, site_image_unavailable (the file is gone, empty or not an image), site_missing (no Site has the slug) or site_setting_unknown (the Site has no such setting, its type cannot be shown, or the slug or key is not written in quotes). Nothing falls back to another value. Outside a message (for example in an Agent's instructions) the setting prints nothing instead. To send without the image, show it only when it is set:

{% if 'enrollment-site' | site_setting('practice_logo') %}
<img src="{{ 'enrollment-site' | site_setting('practice_logo') }}" alt="">
{% endif %}

Publishing a Journey refuses a step whose message, or a snippet it uses, prints a setting that cannot be used now, unless an {% if %} that tests that same setting surrounds it. The email preview shows the setting's real value, and the reason when it cannot be used, to Members who can view Sites; anyone else's preview says it cannot show that setting. Sending is not affected.

enum_label — show the readable label of a select-field value​

Form fields of type Select and Multi-select store values as short slugs (e.g. high, follow_up_needed). Use enum_label to render the human-readable label the field was configured with instead of the slug.

{{ member.data.call_log.call_reason | enum_label('call_reason', 'call_log') }}
→ "Appointment follow-up"

{{ record.data.status | enum_label('status') }}
→ "Awaiting Response"

How to use it:

  • First argument: the field slug inside the data type.
  • Second argument (optional): the data type slug. You can omit it when the template is rendered in the context of a record of that data type (event rules on records, record-scoped actions).

Behavior:

  • Works with member.data.*, member.collections.*.latest.data.*, record.data.*, and any other enum value.
  • Falls back to the raw value if the field, option, or data type can't be resolved — it never errors.
  • Respects workspace permissions — if the template executes under a role that can't read the referenced data type, the filter falls back to the raw value instead of leaking the label.

See rendering contexts for the values available to each template.