Skip to main content

Variable Reference

This page provides a complete reference for all variables and Handlebars helpers available in epilot templates.

Variable Syntaxโ€‹

Variables use Handlebars syntax with double curly braces:

{{variable_name}}
{{entity.attribute}}
{{helper_name argument1 argument2}}

Entity Variablesโ€‹

Access entity data using the entity slug as a prefix:

SyntaxDescription
{{contact.first_name}}Contact's first name
{{order._title}}Order title
{{opportunity.billing_address}}Opportunity's billing address
{{_title}}Title of the main entity in context

Nested Attributesโ€‹

Access nested attributes with dot notation:

{{order.line_items.0.product.name}}
{{contact.payment.0.data.iban}}

Computed Metadata Fieldsโ€‹

Some fields store IDs that are resolved to human-readable values using the :<field> suffix:

{{opportunity._tags:name}}        <!-- Resolved tag names -->
{{opportunity._purpose:name}} <!-- Resolved purpose names -->

System Variablesโ€‹

VariableDescription
{{system.date}}Current date (formatted for the org locale)
{{system.time}}Current time

Environment Variablesโ€‹

Reference organization-level environment variables in templates using the {{ env.* }} prefix. Environment variables are resolved at runtime, allowing the same template to work across sandbox and production environments.

{{env.portal.domain}}
{{env.erp_api.base_url}}
{{env.n8n.metering_webhook_url}}

Using Environment Variables in Templatesโ€‹

Environment variables are supported anywhere template variables work:

Email subject:

Your order confirmation from {{env.company.name}}

Email body:

<p>
View your order in the
<a href="https://{{env.portal.domain}}/orders">customer portal</a>.
</p>

Document templates:

Contact us at {{env.support.email}} or visit {{env.company.website}}
tip

Use Environments & Secrets to manage your organization's environment variables. Variables set there can be referenced with {{ env.key }} in any template.

Variable Typesโ€‹

TypeIn TemplatesIn Webhooks
StringYesYes
SecretStringNoYes

SecretString values are only available in trusted backend contexts (webhooks, integrations) and are never exposed in user-facing templates.

For full details on creating and managing environment variables, see Environments & Secrets.

Organization Variablesโ€‹

VariableDescription
{{organization.name}}Organization name
{{organization.website}}Organization website URL
{{organization.email}}Organization email
{{organization.phone}}Organization phone number
{{organization.address}}Full formatted address
{{organization.signature}}Email signature

User Variablesโ€‹

VariableDescription
{{user.display_name}}Current user's display name
{{user.email}}Current user's email
{{user.phone}}Current user's phone number
{{user.department}}Current user's department
VariableContextDescription
{{consent.optInLink}}EmailDouble opt-in confirmation link
{{unsubscribe_url}}EmailUnsubscribe link
{{portalUser.confirmationLink}}EmailPortal user email confirmation link
{{portalUser.forgotPasswordLink}}EmailPortal password reset link
{{customerPortal.invitationLink}}EmailCustomer portal invitation link
{{installerPortal.invitationLink}}EmailInstaller portal invitation link
{{customerPortal.newDocumentLink}}EmailLink to new document in customer portal
{{customerPortal.entityLink}}EmailLink to entity in customer portal
{{customerPortal.userEmailsOnEntity}}EmailPortal user emails associated with the entity

Handlebars Helpersโ€‹

Standard Library Helpersโ€‹

All helpers from handlebars-helpers are available, including:

  • math: add, subtract, multiply, divide, ceil, floor, round, abs
  • number: bytes, addCommas, toFixed, toPrecision
  • comparison: eq, ne, lt, lte, gt, gte, and, or, not
  • array: first, last, after, before, join, sort, length, map, filter
  • string: capitalize, lowercase, uppercase, trim, truncate, replace, split
  • date: moment (Moment.js formatting)
  • object: get, keys, values, extend, merge
  • url: encodeURI, decodeURI, urlResolve, urlParse
{{add 1 2}}                    <!-- 3 -->
{{multiply price quantity}} <!-- price * quantity -->
{{uppercase "hello"}} <!-- HELLO -->
{{truncate description 100}} <!-- First 100 chars -->

Address Helpersโ€‹

formatAddressโ€‹

Formats an address object into a single-line string.

{{formatAddress 'billing_address.0'}}

addressโ€‹

Formats the primary address from context (searches for billing or primary tags).

{{address}}
{{address "contact"}}

billing_addressโ€‹

Formats the billing address (searches for billing, shipping, or primary tags).

{{billing_address}}

shipping_addressโ€‹

Formats the shipping address (searches for shipping, billing, or primary tags).

{{shipping_address}}

delivery_addressโ€‹

Formats the delivery address (searches for delivery or primary tags).

{{delivery_address}}

additional_addressโ€‹

Formats an additional address tagged as primary.

{{additional_address}}

Contact Helpersโ€‹

emailโ€‹

Retrieves the email address, prioritizing email then billing_email.

{{email}}
{{email "contact"}}

billing_emailโ€‹

Retrieves the billing email, prioritizing billing_email then email.

{{billing_email}}

phoneโ€‹

Retrieves the phone number, prioritizing phone then billing_phone.

{{phone}}
{{phone "contact"}}

billing_phoneโ€‹

Retrieves the billing phone, prioritizing billing_phone then phone.

{{billing_phone}}

Date & Time Helpersโ€‹

formatDateโ€‹

Formats a date string. Defaults to dd.MM.yyyy.

{{formatDate "2025-05-13"}}                <!-- 13.05.2025 -->
{{formatDate order.created_at "yyyy-MM-dd"}}

formatDateTimeโ€‹

Formats a date/time string. Defaults to dd.MM.yyyy HH:mm.

{{formatDateTime "2025-05-13T14:30:00Z"}}
{{formatDateTime order.created_at "yyyy-MM-dd HH:mm:ss"}}

dateMathโ€‹

Performs date arithmetic.

Parameters:

  • inputDate - The starting date
  • expression - Arithmetic expression like +1d, -2w, +1M
  • inputFormat (optional) - Input date format
  • format (optional) - Output date format
{{dateMath "2025-05-13" "+14d"}}           <!-- Add 14 days -->
{{dateMath order.date "-1M"}} <!-- Subtract 1 month -->
{{dateMath "2025-05-13" "+1y" format="dd.MM.yyyy"}}

Expression units: d (days), w (weeks), M (months), y (years)


Currency Helpersโ€‹

asCurrencyโ€‹

Formats a number as currency using @epilot/pricing.

Parameters:

  • amount - The number to format
  • currency (default: EUR) - Currency code
  • locale (default: de) - Locale for formatting
  • displayZeroAmount (default: false) - Show zero amounts
{{asCurrency 1000}}                       <!-- 1.000,00 โ‚ฌ -->
{{asCurrency 99.99 "USD" "en"}} <!-- $99.99 -->
{{asCurrency order.total "EUR" "de" true}}

fromCentsโ€‹

Converts a cent value to decimal. Handles both raw integers and formatted strings.

{{fromCents 23562}}                       <!-- 235.62 -->
{{fromCents "9.999,00 โ‚ฌ"}} <!-- 9999.00 -->
{{multiply (fromCents product.price.amount_total) 1.1}}

toNumberโ€‹

Parses a locale-formatted number string to a number.

{{toNumber "1,50"}}                       <!-- 1.5 (German format) -->
{{toNumber "1.50"}} <!-- 1.5 (English format) -->

Comparison Helpersโ€‹

gtโ€‹

Returns true if the first value is greater than the second.

{{#if (gt quantity 10)}}Bulk discount!{{/if}}

ltโ€‹

Returns true if the first value is less than the second.

{{#if (lt stock 5)}}Low stock{{/if}}

eqโ€‹

Returns true if two values are equal.

{{#if (eq status "approved")}}Approved!{{/if}}

Boolean Helpersโ€‹

ynโ€‹

Converts a boolean value to localized "Yes" or "No".

{{yn true}}                              <!-- Yes / Ja -->
{{yn false}} <!-- No / Nein -->
{{yn is_active "Active" "Inactive"}} <!-- Custom labels -->

xifโ€‹

Returns "x" if truthy, empty string if falsy. Useful for checkboxes in documents.

{{xif is_selected}}

Tag & Filter Helpersโ€‹

withTagโ€‹

Retrieves a value from an array by tag.

Parameters:

  • arr - Array to search
  • tag (default: primary) - Tag to match
  • attribute (optional) - Attribute to extract
{{withTag contacts tag="billing" attribute="email"}}
{{withTag addresses tag="delivery"}}

Special tags:

  • * - Get values from all items (comma-separated)
  • ...tagname - Get all items matching the tag (spread)
{{withTag items tag="*" attribute="name"}}           <!-- All names -->
{{withTag contacts tag="...customer" attribute="email"}}

String Helpersโ€‹

padStartโ€‹

Pads a string to a target length with a character.

{{padStart "5" 3 "0"}}                   <!-- 005 -->
{{padStart invoice_number 8 "0"}} <!-- 00001234 -->

Generates a signed journey link with optional parameters.

Required:

  • journey_id - The journey ID

Optional:

  • custom_url - Custom domain for the URL
  • expires_in - Token expiration (ms format)
  • nonce - Add a nonce to the payload
{{generateJourneyLink hash.journeyId="abc123"}}
{{generateJourneyLink hash.journeyId="abc123" hash.expires_in="7d"}}
{{generateJourneyLink hash.journeyId="abc123" hash.custom_url="portal.example.com"}}

Order Table Helpersโ€‹

These helpers are used internally by Order Table Variables.

HelperDescription
calculateColspanCalculates colspan for table cells
calculatePeriodColspanCalculates colspan for period columns
calculateSummaryColspanCalculates colspan for summary sections
isColumnEnabledChecks if a column is enabled
shouldDisplayDetailsChecks if column details should display
isSummaryVisibleChecks if summary section is visible
isExternalFeesMetadataVisibleChecks if external fees are visible
makeStyleConverts config to CSS style string

Excel-like Formulasโ€‹

The calc helper supports Excel-like formulas for calculations.

{{calc "ROUND(price * quantity, 2)"}}
{{calc "IF(qty > 10, 10, qty)"}}
{{calc "MAX(price1, price2, price3)"}}
{{calc "ROUND(a + b, 0)" a=fee b=shipping}}

Arithmetic Operatorsโ€‹

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division
^Exponentiation
%Modulus
()Grouping
-nNegation

Formula Functionsโ€‹

FunctionDescription
ABS(n)Absolute value
AND(a, b, ...)Logical AND
AVERAGE(a, b, ...)Average of values
CEIL(n)Round up
FLOOR(n)Round down
IF(cond, t, f)Conditional
MAX(a, b, ...)Maximum value
MIN(a, b, ...)Minimum value
NOT(a)Logical NOT
OR(a, b, ...)Logical OR
ROUND(n, places)Round to decimal places
SUM(a, b, ...)Sum of values
RAND()Random number 0-1

Date Functionsโ€‹

All date functions work with ISO 8601 strings and use UTC by default.

FunctionDescription
NOW([tz])Current datetime
TODAY([tz])Current date
DATEADD(date, val, unit, [tz])Add/subtract time
DATEDIFF(start, end, unit, [tz])Difference between dates
YEAR(date, [tz])Extract year
MONTH(date, [tz])Extract month (1-12)
DAY(date, [tz])Extract day (1-31)
HOUR(date, [tz])Extract hour (0-23)
MINUTE(date, [tz])Extract minute (0-59)
SECOND(date, [tz])Extract second (0-59)
WEEKDAY(date, [type], [tz])Day of week
WEEKNUM(date, [type], [tz])Week number

DATEADD units: years, quarters, months, weeks, days, hours, minutes, seconds

{{calc "DATEADD(order.date, 14, \"days\")"}}
{{calc "DATEDIFF(start_date, TODAY(), \"months\")"}}
{{calc "YEAR(invoice.date)"}}

Where Variables Are Supportedโ€‹

FeatureVariablesEnvironment VariablesSecrets
Email templatesYesYesNo
Document templatesYesYesNo
WebhooksYesYesYes
Automation actionsYesYesYes
Entity mappingYesYesYes
Journey configurationsYesYesNo
Customer PortalYesYesNo
ERP integrationsYesYesYes
note

Secrets (SecretString environment variables) are only available in trusted backend contexts like webhooks and integrations. They are never exposed in templates or the frontend.