Voucher helper functions

The voucher helper function lets you access any voucher pool created on CrossEngage and its attributes, so that you may send personalised discount codes to a user through any channel you have set up.

For more information on creating Voucher Pools, see our Voucher Documentation.

The #voucherPool helper function is used to access any voucher pools that you have set up in CrossEngage. Upon message dispatch, the function will access the selected pool and extract a voucher for each user.

Our system will remove any assigned vouchers from the selected pool to ensure that no duplicate vouchers can be sent.

The syntax of this helper function is:

{{#voucherPool '{"name": [Voucher pool name]}'}}
{{[Voucher pool attribute]}}
{{/voucherPool}}

Property

Type

Description

name

string

Required. The name of the of the voucher pool that is accessed.

The voucher pool attributes that may be displayed within a message are the following:

Attribute

Description

name

Optional. The name of the of the voucher pool that is accessed.

code

Required. The voucher code extracted from the voucher pool.

validFrom

Optional. The date the voucher is valid from. e.g. 2018-07-14T00:00:00+0000To format this date, please use the date formatting function.

validTo

Optional. The date the voucher is valid to e.g.2018-08-25T00:00:00+0000. To format this date, please use the date formatting function.

value

Optional. The value or % amount of the voucher. e.g. 10.0.

type

Optional. The type of voucher. The types can be eitherpercentage or the same value as the value attribute, depending on how your voucher pool was set up.

currency

Optional. The currency of the voucher pool.

minBasket

Optional. The minimum basket value that a user must have to be eligible for using a voucher.

conditions

Optional. The usage conditions for this voucher.

created

Optional. The date the voucher pool was created.

modified

Optional. The date the voucher pool was last modified.

Alternative Method

Instead of writing a Handlebar expression from scratch, it is possible to obtain the relevant expressions from within the CrossEngage platform.

  • Navigate to Moreand select Vouchers.

  • Select the specific Voucher Pool you wish to embed in your marketing communication.

  • On the right of the screen is displayed a list of voucher metadata. To pass any of these variables into your marketing communication using a Handlebar expression, simply click the icons indicated below. This will copy the desired Handlebar to your clipboard. Simply paste this formula into your campaign message.

Use cases

Displaying a discount

For this example, we access the Summer Sale voucher pool. This example voucher pool is valid from 01.07.2018 until 30.08.2018 and offers EUR 30.00 discounts to all shop visitors that make orders over EUR 200.00 in the category Summer Sale.

To display the voucher pool's validity dates in our preferred dd/mm/yyyy format, we will use the date formatting function.

{{#voucherPool '{"name": "Summer Sale Discount"}'}}
Use {{code}} to save {{value}} {{currency}} on your next order!
(valid {{computeDate '{"dateTrait": "validFrom", "outputFormat": "dd/MM/yyyy"}'}}
until {{computeDate '{"dateTrait": "validTo", "outputFormat": "dd/MM/yyyy"}'}})
*Only valid for purchases over {{minBasket}} {{currency}}.
Terms and conditions apply: {{conditions}}
{{/voucherPool}}

Once the function is evaluated, it displays the following text in the section where it is used in the message:

Use SD30Sdjat77 to save 30.0 EUR on your next order!
(valid from 01/07/2018 until 30/08/2018)
*Only valid for purchases over 200.0 EUR.
Terms and conditions apply:
- This voucher is only valid for purchases made in our Summer Sale category.
- A voucher can only be used once.
- The voucher is non-transferable.
- This voucher must be redeemed on our website, applying it during the checkout process.