Overview

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
RESTPOSThttps://[Your URL]/api/2.0/trans_mails/template
XML-RPCCallCreateTemplate

Your method must be structured as follows:

Parameters

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.

PropertyTypeDescriptionDefaultRequired
$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

Code Samples

PHP: 

$template_hash = 'hash here';
$emails = array('[email protected]' => 'Example name');
$common_tags = array('common_tag_placeholder' => 'Common tag data');
$unique_tags = array('[email protected]' => array('unique_tag_placeholder' => 'unique tag data'));
$result = $api->send($template_hash, $emails, $common_tags = [], $unique_tags = [], $attachments = []);

JSON:

{
  "identifier": "sJWnzzH5VzOiZ8Ki",
  "emails": {"[email protected]": "Example name"},
  'settings': {},
  'tags' : {"common_tag_placeholder": "Common data"}
  'unique_tags' : {"[email protected]": {"unique_tag_placeholder": "Unique data"}}
}