API Templates
API users can easily manage their email templates by creating, editing, testing, and previewing them directly from the "Settings > Templates" section of the control panel.
If it's your first time, click the "Get Started with Email Templates" button and select the desired email template to enter the editing mode.
If you've already created a template, you'll see a list of your templates with options to "Add email template" or edit your existing templates by clicking on the template's name or by using the drop-down menu on the right side of the template's row and selecting "Edit template".
When adding or editing a template, you can set a friendly "Name", the "Subject" as it will appear in the customer's inbox, and any custom tags used to describe or categorize your template. The Template ID can be customized to suit (minimum of 5 characters and a maximum of 24 characters).
On the left side, the "Edit" tab allows you to edit the HTML code and switch to view the Plain Text version (which is automatically generated based on the HTML code). The "Preview" tab will display the email template as your recipient will see it.
On the right side, there is a "Show Template Variables" option which allows you to set and use variables - think of them as "mail merge fields". When you make your API call, you can set these variables to whatever you need to customize the email for each recipient.
When editing the HTML, you will encapsulate the variable inside two braces, like this:
{{ variable_name }}
Our templating feature also supports HandleBarsJS so you can add lists to your templates, e.g. invoice line items. For more information, visit the HandleBarsJS Guide.
HandleBarsJS is capable of conditional statements. For example, if you don't have the 'first name' of some recipients, you can use the following to mention the first_name variable if it exists (preceded by a space). Otherwise it will simply show "Hi,"
Hi{{#if first_name}} {{first_name}}{{/if}},
HTML can be used in the variable braces by using triple braces to escape the markup:
{{{ <a href="https://www..."> </a> }}}
More details in this section of the HandleBarsJS Guide.
Once you have finished editing, click the "Save Template" button towards the bottom of the screen to add it to the template list. You will then have the option to click the "Integrate" button to generate the code snippet in various languages as well as the "Send test" button to send a test email of your template to a desired recipient (note - the From address you set will need to be a verified sender and it will count towards your plan's monthly email allowance).
If you have questions or need help with templates, please contact our support team who can assist further.