Contact Object

contact.in_list

contact.in_list will allow you to add conditional content based on whether they're in a list or not. In conjunction with our Dynamic Lists functionality it allows for behavioural filtering with conditional content.

The call accepts a list id and will return a boolean, which is based on whether a contact is in the specified list.

Copy
contact.in_list(<list_id>)

Example use:

Copy
[* IF contact.in_list(1234) *]
<b>You're subscribed to our offers list already</b>
[* ELSE *]
<a href="#...">Subscribe to our offers list here!</a>
[* END *]

Note: If you have contact as a variable name you won't be able to use the contact object.

contact.promotion

contact.promotion(id) is used for the promotion codes call

Copy
[* promotion = contact.promotion(promotion_id) *]

With its methods you will be able to assign promotion codes to contacts at campaign launch. Please note: promotion codes will have to be imported to Adestra first. Please see our Promotion Codes documentation to take you through the process.

It has three methods:

  • has_available_codes: this returns true if there are any codes still available for the promotion
  • get_code: looks up any existing code for the contact and returns it or allocates one if there isn't
  • get_code_form_campaign(campign_id): looks up any existing code for the contact for the given campaign and returns it if it exists. It does not allocate a new code on that campaign

contact.transaction

Using the transaction result set, you will be able to find information about all transactions for a contact and search for specific transactions. You can also find product information, both related to the transaction and specifically for a product; reference number, name etc.

Iterating over Transactions

By iterating over the transactions result set you can return a transaction object - allowing you to retrieve transaction and product information.

Attribute Type Description
all Array Returns a list of Transaction objects
search Result Set Returns result set of Transaction objects, that match search term
find Result Object Returns the first Transaction object that matches the find term
orderby Result Set Returns result set of Transaction objects, ordered by given column name
first Result Object Returns first Transaction object in the result set
count Integer Returns total number of Transaction objects in the result set

Transaction Information

Attribute Type Description
brand_id Integer Returns the brand id related to the transaction
is_abandoned Boolean A 1 or 0 to indicate whether the transaction was abandoned or not
token String Returns the transaction reference
email String Returns email of the contact related to the transaction
order_value Numeric Returns the numeric value of the transaction (agnostic of currency)
data HashRef User defined additional data
created Date Time Object Returns the time at which the transaction was created in our database

Product Information

To see the the attributes available to the product object, refer to the Campaign Template API topic. The same public fields are available to the Contact Template API code.

Tag Information

You can search through transactions and products by the tags that have been user defined by using iterators.

  • List all tags for a transaction: [* transaction.tags.all *]
  • Return the name of the first tag in a transaction: [* transaction.tags.first.name *]
  • Return the value of the first product tag: [* product.tags.first.value *]
Attribute Type Description
name String Returns the name of the tag
value String Returns the value of the tag