Templates

Placeholders, data and what happens when a value is missing.

A template is HTML with placeholders in the form {{field}}. The name takes letters, digits, dot, hyphen and underscore, and inner spaces do not count: {{ name }} and {{name}} are the same placeholder.

<p>Hi {{name}},</p>
<p>we received your request of {{date}}.</p>

The values arrive in the send request inside templateData:

{ "templateData": { "name": "Mario", "date": "20 August" } }

Substitution is textual

Even though the syntax looks like Handlebars, it goes through no template engine at all: there are no conditionals, no loops and no helpers. If you need a variable part, you build it in the caller and pass it as data.

A placeholder with no value stays visible in the message instead of disappearing. That is deliberate: {{name}} in an email gets noticed and fixed, an empty gap does not.

Values are not sanitized

Data goes into the HTML unescaped, because templates carry links and markup built out of the data itself. Anyone passing content written by third parties cleans it up beforehand: templateData is not a safe place to drop the input of a public form without looking at it.

One template, several projects

Templates belong to the user, senders belong to the projects. The same template can therefore go out from different projects, and the sender changes without touching its content.