Templates
The templates section contains the templates used for your messages. If your integration generates the full message body you probably won't take advantage of this feature but in case you are sending transactional messages templates can be of great help to you.
Templates allow you to separate your data (passed in API call) from presentation (HTML). It not only makes changes to your emails much easier but provides features for data processing (conditions, loops, math, etc.) that will help you speed up the development of your email messages beyond their original scope.
What's the use?
Let's take a simple order confirmation email as an example. You could generate the full message body in your application and pass it to Omnivery for delivery and be done with it... but then few months later there will be a request for a change. This might be a small design change or a requirement to extend the scope of the message and add a list of items from the order. At this stage you would be altering your code to include the new bits, maybe you use some templating internally but utltimately this requires more manhours on the integration side.
On the other hand you could just pass the template name and variables to Omnivery and let our backend generate the HTML based on the template. That template can be managed by someone from marketing or pretty much any skilled HTML coder reducing the cost to maintain the templates.
Templates can also access some internal variables provided at the time of send and be used in conditions to drive the message content. These include:
- from - From address of the message
- rcpt - Recipient address of the message
- subject - Message subject
- date - The date object contains curent date & time in UTC
- year,month,day,hour, minute - Current date and time variables
- domain - The domain object contains information about your sending domain and it's settings
- name - Domain name
- transactional (true/false) - is domain transactional
- tracking_open, tracking_click, tracking_unsubscribe - tracking settings of the domain
Omnivery currently supports two templating formats - Handlebars and Template Toolkit. You can select the format of the template while editing the template and it can be switched at any time.
We expect template coders to be familiar with HTML and the templating language of their choice and paste a ready to use HTML into the template file.