Skip to main content

Templates and company data

The template library holds the frames of your e-mails and input pages, so that header, footer and signature are written once.

The library​

Open Templates in the menu. A template has a kind (e-mail or page), a name and several parts ("slots"): an e-mail has subject, preheader, header, main text, footer, signature and an unsubscribe line; a page has title, description and footer text. New templates start from a preset. Click a template (or its pencil) to open it: the list folds up to one line (Templates unfolds it again, Close leaves the template) and the template opens in the same page, it has its own address, and a template can also be opened from the file storage. You edit it as the page the recipient gets: the whole mail is shown, the parts above the editor (Header, Main part, Footer …) choose the part you type in, the other parts stay visible but locked. The Variables menu inserts company data and standard values. The subject and the preview line are single lines above the editor. The preview next to it shows the result with the company data filled in and follows what you type; its switch shows it at desktop, tablet and phone width. The assistant is on the left (button Assistant); ask it to write or improve a template, to check the placeholders or to show a preview. On a phone the assistant starts hidden.

Every template shows Used by n diagram(s) (hover for the names; only stored diagrams are counted, not an editor with unsaved changes and not a run that already started). Rename writes the new name into those diagrams, so they keep finding the template; editors that are open on such a diagram have to be reloaded. If a diagram cannot be saved the rename stops with its name and the template stays under both names. Delete names the diagrams that use the template first.

Use a template in an activity and refine it there​

In the node editor of an e-mail activity click Template; for an input page click Page. The editor shows the whole mail (or page) with header, text and footer: pick a template of your library, choose the part above the editor and change it, the preview and the assistant on the left (it knows the node, its variables and the answer links of the decision after it) help. Saving stores the name of the template in the activity and only the parts you changed: your text, the subject, a different footer. Every part you did not touch still comes from the template, so a new logo or footer in the library reaches all mails that did not refine it. Emptying a part you did not write yourself leaves it empty on purpose for this activity. Picking another template drops the refined header/footer of the old one (text and subject stay). Without a template only the text of the activity is edited, as before. The library template itself is never changed from the activity.

Company data​

The tab Company data is your list of key/value pairs: company name, address, phone, links, and anything you add (text, number, yes/no, date). The predefined rows can change their value but not their name and cannot be deleted. In a template, write $template.company.name; $std.date, $std.year and others are always there. If a value is empty the assistant asks you for it instead of inventing it.

Placeholders​

  • ${variable.name}: a variable of the diagram. $!{variable.name} is the quiet form (the one the variables menu inserts): it writes nothing when the variable has no value, where ${variable.name} stays in the text as it is.
  • $template.<key>: an entry of the company data. $!template.<key> writes nothing when the entry does not exist.
  • $std.date, $std.time, $std.year, $std.weekday, $std.now: standard values.
  • In the HTML part of a mail the values of ${variable.x} and $template.x are escaped, so < or & in a customer name cannot break the page. A value that already is trusted HTML is written $raw.x.
  • Templates are code for the engine, but a restricted one: no #include, no #parse, no reflection. A template with a script tag, event attributes (onclick=), javascript: links, frames, a form in a mail, or a password written into the text is refused when you save it.

A variable can contain variables​

The value of a variable is itself searched for placeholders, and so on, until nothing is left to replace (a depth of 20 levels protects against a variable that refers to itself). This lets you build a text from reusable parts. Set a generic variable once, for example in an earlier activity:

greeting = Hello ${variable.customer.name}, your order ${variable.order.id} is ready.

and write just ${variable.greeting} in the mail, the input page or the prompt of an AI activity. Every placeholder inside greeting is filled with the values the diagram has at the time the text is used, so the same greeting reads differently for each customer. A placeholder without a value stays visible as written (${variable.x}) or, in the quiet form $!{variable.x}, disappears. This applies to variables of the diagram (${variable.…}); the company data ($template.…) and standard values ($std.…) are filled by the template engine of the page or mail.

Treat what customers type with care: a value that came from outside is also searched, so a customer who types ${variable.secret_note} into a form field can make that variable appear. Secrets (${secret:…}) are never filled in from a variable's value, only from the text you wrote yourself.

What a recipient gets is cleaned​

Before a mail or an input page leaves the server, its HTML is run through an allow-list: layout, tables, links (http, https, mailto, tel), images (http, https, cid) and inline styles stay; scripts, forms, frames, event attributes, javascript: links and styles that run code are removed, wherever the text came from (editor, activity parameter, assistant). The cleaning happens after the placeholders are filled in, so it also covers $raw.x and a text typed into an earlier form. Placeholders with a dotted name work in all forms: ${variable.customer.name}, $!{variable.customer.name}, ${raw.customer.html}.

The assistant's changes can be undone​

When the assistant writes a template or an entry of the company data, the change shows up in its change list like a diagram edit and can be undone there (newest change first, and only while you did not change the same template yourself since). That is why it no longer asks before it changes an existing template.

Changes never reach a running diagram​

The text of a template is copied into the diagram when a run starts (the placeholders stay and are filled later). Editing or deleting a template therefore never changes a run that already started or sleeps, and the links it sent stay valid. A change applies to runs started afterwards. A template named in a node that does not exist stops the start with a validation error.

The unsubscribe line​

Offer ${action.unsubscribe} in newsletters and add an outgoing edge unsubscribe after the mail decision. The link only takes that edge; blocking the address afterwards is up to your diagram.