Skip to content

Working with E-mail Templates

There are various variables presented to you in the e-mail builder tool. These are available for use in any environment (i.e. in Automations and in Social Posts). However, more variables are available for the automations tool. You can find this list below. Some items are marked as objects, which means they provide direct low-level code access to the related object. Our support team can sometimes advise you to use variables based on these objects.

  • article_id — Article ID / Content ID

For all triggers with a customer attached to them, including payment triggers, the following variables are available.

  • visitor_id
  • EMAIL
  • FULL_NAME
  • FIRST_NAME
  • LAST_NAME
  • customer
  • code (Forgot your password and Email activation request triggers)

For all triggers with an attached payment, including subcription triggers, the following variables are available:

  • AMOUNT
  • CURRENCY
  • visitor_id
  • subscription_id (if present)
  • order_id
  • order
  • cart (deprecated)
  • price_matrix['subtotal']
  • price_matrix['shipping']
  • price_matrix['tax']
  • price_matrix['discount']
  • price_matrix['total']

For all triggers with an attached subscription, the following variables are available:

For all triggers related to Form Submission, the following variables are available:

  • form
  • form_id
  • submission_id

Response object, with its fields mapped to the alphanumeric keys in the form structure. An example is below:

  • form.response
  • form.response.name
  • form.response.email
  • channel_id — ID of the Social Channel
  • channel_post_id — Available when a Social Post is opened or read

Forgot your password / Email activation request triggers

Section titled “Forgot your password / Email activation request triggers”
  • code — Activation code to send with your API call
  • logs — JSON-encoded array of log messages
  • total — Total subscriptions found for renewal
  • success — Total subscriptions renewed without errors

While authoring your e-mail, you can also use condition statements to decide whether a container should show for a user or not. The container itself will not be sent in the e-mail’s source.

While inspecting a Container or Columns block in the e-mail builder, navigate to the Visibility condition field. You can write condition statements using Smarty-style scripting.

To use a variable in the condition statement, you must prefix it with the dollar sign $.

  1. To check whether a customer has an active subscription, you can write the following statement: $customer.subscriptions|count gt 0

  2. To check if the customer is located in the country ZA: $customer.country_code eq "ZA"

  3. To check if the customer has a profile picture: $customer.photo neq ''

For assistance in writing condition statements, contact our support team.

Modifiers are Smarty functions that can be applied to variables. They start with a | character. For example, variable|count.

The most common ones you could use are:

  • count
  • empty

Use Smarty operators to compare values:

Operator Meaning
eq Equal to
neq Not equal to
gt Greater than
lt Less than
gte Greater than or equal to
lte Less than or equal to

To invert any expression, prefix it with !. For example, !($customer.active) evaluates to true when the customer is not active.

You can use the below functions to check for conditions inside arrays or to evaluate customer state:

in_array(16, $customer.tags) evaluates to true if the customer has the tag with ID 16 attached to them.

A set of built-in helper functions is available under the C:: namespace. These simplify common subscription and channel checks.

The group_name argument accepts either a single quoted string or an array of group name strings. When an array is provided, the function matches against any of the listed groups:

  • Single group: 'premium'
  • Multiple groups: ['basic', 'premium'] or ['insider', 'donation']

The channel_id argument must be a single quoted string. You can prefix any expression with ! to invert it.

Function Description
C::hasActiveSubscription($customer, 'group_name') True if the customer has an active subscription in the given group.
C::getActiveSubscriptionPrice($customer, 'group_name') gt 0 True if the customer’s active subscription price in the given group is greater than 0. Replace gt 0 with any comparison to check a specific price.
C::neverSubscribed($customer, 'group_name') True if the customer has never held a subscription in the given group.
C::hasRetryingSubscription($customer, 'group_name') True if the customer has a subscription in the given group that is currently in a payment retry cycle.
C::hasExpiredNotRetryingSubscription($customer, 'group_name') True if the customer has a subscription in the given group that has expired and is no longer retrying payment.
C::cardExpiringThisMonth($customer) True if the customer’s payment card expires in the current month.
C::subscribedToChannel($customer, 'channel_id') True if the customer is subscribed to the given channel.
C::hasTag($customer, 'tag_id') True if the customer has the given tag assigned to them.

Examples

  • Show a block only to customers without an active subscription in the “premium” group: !C::hasActiveSubscription($customer, 'premium')

  • Show a block only to customers whose card is expiring this month: C::cardExpiringThisMonth($customer)

  • Show a block only to customers who have never subscribed to the “basic” group: C::neverSubscribed($customer, 'basic')

All variables that are objects provide additional properties that can be displayed to the customer or used as conditions.

The object’s structure is the same as the structure you would receive from the API. Below is a list of all properties that you can use.

For arrays, you can apply modifiers. See the modifiers sections.

Property Type Notes
customer.id int Unique customer ID
customer.loginName string Login e-mail address
customer.displayName string Full display name
customer.photo string Profile picture URL; empty string when not set
customer.accountType int 0 = social/passwordless account, 1 = has credentials
customer.user_type string e.g. subscriber
customer.active int 1 when the account is active
customer.clientId int Internal client identifier
customer.source string Acquisition source, e.g. organic
Property Type Notes
customer.country_code string ISO 3166-1 alpha-2 country code, e.g. NL
customer.country string Country name
customer.city string City name
customer.mobile string Mobile number in international format
customer.preferredLanguage string BCP 47 language tag, e.g. en
customer.dateOfBirth int Unix timestamp
customer.lastLogin int Unix timestamp of last login
customer.lastLoginCountry int Country ID at last login
Property Type Notes
customer.creationDate int Account creation date as Unix timestamp
customer.creationDay string Day and month of creation in DDMM format, e.g. 0101
customer.registeredSinceCohort string Cohort bucket based on account age: M0, M1-3, M3-6, M6-12, Y1Y10+
customer.payment_expiry int Unix timestamp of the latest payment expiry
customer.maxExpiry int Unix timestamp of the furthest future subscription expiry
customer.minActivation int Unix timestamp of the earliest subscription activation
customer.totalSubscriptionDays int Cumulative active subscription days (rounded up)
customer.archiveCredits int Number of remaining archive credits
Property Type Notes
customer.preferences object Full preferences object
customer.preferences.optout_marketing string "1" if opted out of marketing, "0" otherwise
customer.preferences.optout_marketing_date int Unix timestamp when the opt-out was recorded; 0 if not set
customer.preferences.country_code string Country code stored in preferences
Property Type Notes
customer.address.street string Street and house number
customer.address.city string City
customer.address.postalCode string Postal / ZIP code
customer.address.country string ISO country code
Property Type Notes
customer.properties object Key-value pairs of custom fields set on the account
Property Type Notes
customer.payment object Latest payment; may be absent if no payments exist
customer.payment.id int Payment ID
customer.payment.status string e.g. completed
customer.payment.price string Amount as a decimal string
customer.payment.currency string ISO 4217 currency code, e.g. EUR
customer.payment.price_baseCurrency string Amount in the account’s base currency
customer.payment_tokens object Stored payment tokens keyed by provider name (e.g. stripe); only present when a token is on file
customer.payment_tokens.{provider}.token string Provider token
customer.payment_tokens.{provider}.guid string Internal GUID
customer.payment_tokens.{provider}.expiry string Card expiry date
customer.payment_tokens.{provider}.lastdigits string Last 4 digits of the card
customer.payment_tokens.{provider}.payment_method string e.g. card
Property Type Notes
customer.tags int[] Array of tag IDs assigned to the customer
customer.tags[n] int ID of a single tag
Property Type Notes
customer.subscriptions array All subscriptions on the account
customer.subscriptions[n].id int Subscription ID
customer.subscriptions[n].activationDate int Unix timestamp
customer.subscriptions[n].deactivationDate int Unix timestamp; 0 if still active
customer.subscriptions[n].status int 1 = active
customer.subscriptions[n].product int Product ID
customer.subscriptions[n].group string Subscription group name
customer.subscriptions[n].paymentMethod string e.g. stripe
customer.subscriptions[n].nextRenewal int Unix timestamp of next renewal
customer.subscriptions[n].cancellationRequestDate int Unix timestamp; 0 if no cancellation requested
Property Type Notes
customer.channels int[] IDs of channels the customer is subscribed to
customer.channels_optout int[] IDs of channels where the customer has opted out or is inactive
customer.channels_timestamps_cohort object Cohort string keyed by channel ID indicating when the customer subscribed, e.g. { "1": "Y1" }
customer.channels_details array Detailed subscription info per channel
customer.channels_details[n].channelId int Channel ID
customer.channels_details[n].optout int 1 if opted out
customer.channels_details[n].active int 1 if active
customer.channels_details[n].timestamp int Unix timestamp of subscription
customer.channels_details[n].optout_timestamp int Unix timestamp of opt-out; 0 if not opted out
Property Type Notes
customer.read_posts int[] IDs of posts the customer has opened
customer.click_posts int[] IDs of posts the customer has clicked
customer.read_time object Unix timestamp of last open per channel ID, e.g. { "1": 1718700000 }
customer.click_time object Unix timestamp of last click per channel ID
  • order.id
  • order.price
  • order.status
  • order.responseMessage
  • order.lastUpdate
  • order.timestamp
  • order.userId
  • order.paymentMethod
  • order.cart (deprecated)
  • order.price_matrix
  • order.price_matrix.subtotal
  • order.price_matrix.tax
  • order.price_matrix.discount
  • order.price_matrix.shipping
  • order.price_matrix.total
  • order.items_details (array)
  • order.items_details[n].item
  • order.items_details[n].price
  • order.items_details[n].quantity
  • order.items_details[n].item.description
  • order.shippingStatus
  • order.authorization
  • order.address
  • order.shipping_address
  • order.shipping_price
  • order.tax_price

Inside a Container or Columns block that has a data source set to: Product Items, you can use the below variables:

  • item.price
  • item.quantity
  • item.item.description
  • subscription.id
  • subscription.activationDate
  • subscription.deactivationDate
  • subscription.status
  • subscription.product
  • subscription.product.description
  • subscription.purchased_item
  • subscription.purchased_item.name
  • subscription.nextRenewal
  • subscription.lastFailedOrder
  • subscription.attempts
  • subscription.referenceOrderId
  • subscription.group
  • subscription.group_name
  • subscription.paymentMethod

Available for automations linked to form submissions.

Property Type Notes
form.id int Unique form ID
form.name string Form name
form.fields array Field definitions for the form
form.captcha_enabled bool Whether CAPTCHA is enabled on the form
form.allow_anonymous bool Whether anonymous submissions are permitted
form.response object Key-value pairs mapping each field’s alphanumeric key to the answer provided by the user

form.response contains one entry per form field, keyed by the field’s alphanumeric identifier. For example, if your form has fields with keys name and email:

  • form.response.name
  • form.response.email

Use the field keys defined in your form structure to access individual answers.