How to create templates in Doppler Relay

To create a template in Doppler Relay you must enter your account, and access the section called Templates. Once there you will see a button with the option to create a new template.

You will be redirected to a new page where you will see these 4 fields.

  • Template name: This field is for internal use, so you can include an identifying name in your template dashboard.
  • Email Subject: Here you can determine the subject of this specific Transactional Email.
  • Sender’s Name: Write here how the sender will appear in customer’s inbox. For example, you can include something like John from Doppler Relay.
  • Sender’s Email: Finally you can also determine sender’s email. It is very important to improve not only the opening of your emails but also for your customers to associate an email to your company.

Once finished this, is time to create your template. To be able to customize the HTML of your template it is necessary to use dynamic fields.

What is a dynamic field?

Dynamic fields are part of the Email content that is modified based on client’s information. Dynamic fields allow you to personalize messages and include personal information for each client.

How to build a dynamic field?

The Doppler Relay templates use a very simple, but very powerful language, called Mustache. This language includes some advanced features that make it ideal for writing texts and HTML.

As with other template languages, start and end markers are defined as double braces. For example:


The blank space inside the keys is ignored. All of the following are equivalent:

{{ value }}
{{  value   }}

If you have a template model like this (represented as JSON):

"user" : {
"name" : "John",

And this template

Hi {{}} 

Mustache will produce this content when you combine both:

Hi John

Mustache is permissive about the values lost in its models. If you search for a property that doesn’t exist, Mustache will skip that section.

In this way, you can create templates that do not require if / else logic.

Using the following model:

  "company" : "Doppler Relay",
  "employees" : [
    { "name" : "John", "role" : "IT Architect" },
    { "name" : "Miguel" }

The template would be something like this:

     {{name}} works for: {{company}}
     {{#role}}como {{.}}{{/role}}

When we use Mustache we will produce the following HTML:

  <li>John woks for: Doppler Relay as IT Architect</li>
  <li>Miguel works for: Doppler Relay</li>

Substitutions are applied by recipient using replacement data provided as part of the transmission and recipient JSON structures.

In the simplest case, the substitution data is a JSON object of recipient-specific key/data value pairs. In a more complex case, the substitution data can consist of nested JSON objects and even arrays of objects.

This allows you to write statements that run through an array of JSON objects and substitute values that exist in each object in the array, for example, an array of customer orders.

"name" : "Juan",
"age" : 27,
"state" : "MD",
"is_member" : true

In this case, your dynamic fields would be the following:

  • {{name}}
  • {{age}}
  • {{state}}
  • {{is-member}}

Was this article helpful?
Help us improve our assistance by rating it
1 Star2 Stars3 Stars4 Stars5 Stars

Leave a Reply

Your email address will not be published.

I accept Doppler's Privacy Policy.

Doppler informs you that the personal data that you provide to us when completing this form will be treated by Doppler LLC as responsible for this web.

Purpose: To allow you to make comments in our help center.

Legitimation: Consent of the applicant.

Recipients: Your data will be saved by Doppler and Digital Ocean as hosting company.

Additional information: In the Doppler Privacy Policy you’ll find additional information about the collection and use of your personal information by Doppler, including information on access, conservation, rectification, deletion, security, cross-border data transfers and other issues.