Personalising Transactional Email Templates

If you are using transactional email templates, you can use this request to insert personalised information into the templates before the emails are sent. This is especially useful when sending password reminder emails, voucher codes, or account balances.

When using this request, you must specify the template by using the template hash associated with it, provide us with the tag that will be used to personalise the email, and provide the data that will be substituted into the tag when the email is sent.

The Method

API Method
RESTPOSThttp://[Your URL]/api/2.0/trans_mails/template
Your URL is the address of your install.

Your method must be structured as follows:

CreateTemplate(string | array$properties)


Required Parameters

You must specify the template hash, the placeholder tag, and the data that will be substituted into the placeholder when the email is sent.

PropertyType DescriptionDefaultRequired
$identifierstringThis is the unique template identifier, assigned to each template when it is created.noneyes
$emailsarrayThe email addresses which this email must be sent to.noneyes
$tagsarrayList of common tags in the template.noneyes
$unique_tagsarrayThe unique tags, such as email address or new password, which must be included in the email.noneyes
$settingsarrayTransactional sending settings, these would be the same as the settings when sending a normal transactional email.noneyes
You can add an array of attachments to the email using the $attachments tag.

Code Samples




The rest of this docuemtn describes the examples above step-by-step.


1. Template hash

This line of code "calls" the created template using the hash ID, to be used for the email. The template hash ID is found in your transactional mail template page.

$template_hash = 'hash here';

2. Email list

This line of code stores the email addresses in an array.

$emails = array('' => 'Example name');

3. Tags

This line of code lists the common tags in the template.

$common_tags = array('common_tag_placeholder' => 'Common tag data');

4. Unique Tags

This line of code sets up the unique tags related to the email such as new password or email address, which must be included in the email itself.

$unique_tags = array('' => array('unique_tag_placeholder' => 'unique tag data'));

5. Result

This line of code tells the API to send the transactional mail using the parameters defined before.

$result = $api->send($template_hash, $emails, $common_tags = [], $unique_tags = [], $attachments = []);


This JSON code does exactly the same thing as the PHP above.


"identifier": "sJWnzzH5VzOiZ8Ki",

"emails": {"": "Example name"},

'settings': {},

'tags' => {"common_tag_placeholder": "Common data"}

'unique_tags' => {"": {"unique_tag_placeholder": "Unique data"}}


Translate »