Skip to content

Working with E-mail Templates

There are various macros 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 macros 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 macros based on these objects.

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

  • {{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 macros are available:

  • {{AMOUNT}}
  • {{CURRENCY}}
  • {{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 macros are available:

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

Form object, with its fields similar to the API:

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}}

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 macro 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 macros. They start with a | character. For example, macro|count.

The most common ones you could use are:

  • count
  • empty

Use Smarty operators to compare values:

OperatorMeaning
eqEqual to
neqNot equal to
gtGreater than
ltLess than
gteGreater than or equal to
lteLess 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.

FunctionDescription
C::hasActiveSubscription($customer, 'group_name')True if the customer has an active subscription in the given group.
C::getActiveSubscriptionPrice($customer, 'group_name') gt 0True 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 macros 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.

PropertyTypeNotes
customer.idintUnique customer ID
customer.loginNamestringLogin e-mail address
customer.displayNamestringFull display name
customer.photostringProfile picture URL; empty string when not set
customer.accountTypeint0 = social/passwordless account, 1 = has credentials
customer.user_typestringe.g. subscriber
customer.activeint1 when the account is active
customer.clientIdintInternal client identifier
customer.sourcestringAcquisition source, e.g. organic
PropertyTypeNotes
customer.country_codestringISO 3166-1 alpha-2 country code, e.g. NL
customer.countrystringCountry name
customer.citystringCity name
customer.mobilestringMobile number in international format
customer.preferredLanguagestringBCP 47 language tag, e.g. en
customer.dateOfBirthintUnix timestamp
customer.lastLoginintUnix timestamp of last login
customer.lastLoginCountryintCountry ID at last login
PropertyTypeNotes
customer.creationDateintAccount creation date as Unix timestamp
customer.creationDaystringDay and month of creation in DDMM format, e.g. 0101
customer.registeredSinceCohortstringCohort bucket based on account age: M0, M1-3, M3-6, M6-12, Y1Y10+
customer.payment_expiryintUnix timestamp of the latest payment expiry
customer.maxExpiryintUnix timestamp of the furthest future subscription expiry
customer.minActivationintUnix timestamp of the earliest subscription activation
customer.totalSubscriptionDaysintCumulative active subscription days (rounded up)
customer.archiveCreditsintNumber of remaining archive credits
PropertyTypeNotes
customer.preferencesobjectFull preferences object
customer.preferences.optout_marketingstring"1" if opted out of marketing, "0" otherwise
customer.preferences.optout_marketing_dateintUnix timestamp when the opt-out was recorded; 0 if not set
customer.preferences.country_codestringCountry code stored in preferences
PropertyTypeNotes
customer.address.streetstringStreet and house number
customer.address.citystringCity
customer.address.postalCodestringPostal / ZIP code
customer.address.countrystringISO country code
PropertyTypeNotes
customer.propertiesobjectKey-value pairs of custom fields set on the account
PropertyTypeNotes
customer.paymentobjectLatest payment; may be absent if no payments exist
customer.payment.idintPayment ID
customer.payment.statusstringe.g. completed
customer.payment.pricestringAmount as a decimal string
customer.payment.currencystringISO 4217 currency code, e.g. EUR
customer.payment.price_baseCurrencystringAmount in the account’s base currency
customer.payment_tokensobjectStored payment tokens keyed by provider name (e.g. stripe); only present when a token is on file
customer.payment_tokens.{provider}.tokenstringProvider token
customer.payment_tokens.{provider}.guidstringInternal GUID
customer.payment_tokens.{provider}.expirystringCard expiry date
customer.payment_tokens.{provider}.lastdigitsstringLast 4 digits of the card
customer.payment_tokens.{provider}.payment_methodstringe.g. card
PropertyTypeNotes
customer.tagsint[]Array of tag IDs assigned to the customer
customer.tags[n]intID of a single tag
PropertyTypeNotes
customer.subscriptionsarrayAll subscriptions on the account
customer.subscriptions[n].idintSubscription ID
customer.subscriptions[n].activationDateintUnix timestamp
customer.subscriptions[n].deactivationDateintUnix timestamp; 0 if still active
customer.subscriptions[n].statusint1 = active
customer.subscriptions[n].productintProduct ID
customer.subscriptions[n].groupstringSubscription group name
customer.subscriptions[n].paymentMethodstringe.g. stripe
customer.subscriptions[n].nextRenewalintUnix timestamp of next renewal
customer.subscriptions[n].cancellationRequestDateintUnix timestamp; 0 if no cancellation requested
PropertyTypeNotes
customer.channelsint[]IDs of channels the customer is subscribed to
customer.channels_optoutint[]IDs of channels where the customer has opted out or is inactive
customer.channels_timestamps_cohortobjectCohort string keyed by channel ID indicating when the customer subscribed, e.g. { "1": "Y1" }
customer.channels_detailsarrayDetailed subscription info per channel
customer.channels_details[n].channelIdintChannel ID
customer.channels_details[n].optoutint1 if opted out
customer.channels_details[n].activeint1 if active
customer.channels_details[n].timestampintUnix timestamp of subscription
customer.channels_details[n].optout_timestampintUnix timestamp of opt-out; 0 if not opted out
PropertyTypeNotes
customer.read_postsint[]IDs of posts the customer has opened
customer.click_postsint[]IDs of posts the customer has clicked
customer.read_timeobjectUnix timestamp of last open per channel ID, e.g. { "1": 1718700000 }
customer.click_timeobjectUnix 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 macros:

  • 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