What are Special Functions for templates?

View online

Creating a 'View online' link requires special code, because it's different for every message and not yet known when the template is applied. We dealt with that for you by creating a special macro for this:

<a href="<@onlineLinkUrl/>">View online</a>

Please note that an Archive FlowStep is required if you want to have a view online link, since that's what we will link to. If one is missing but a template requires it, messages will be held. The Archive FlowStep does not need to be set before the Template that refers to it, so you can still for instance insert it at the end of the Flow.

 

Editable regions

If you want to make regions of a template editable using the Quick editor (real templates only, not applicable to FlowStep settings), you can mark it like this:

<table>
   <tr>
      <td>
         <#-- REGION: intro -->
           This is a text.
         <#-- END REGION: intro -->
      </td>
   </tr>
</table>

Every region in a template needs to have a unique name (in this case "intro"). We advise keeping the regions as small as possible, containing only paragraphs of text or other single elements such as a table cell containing a logo image. Using a visual editor to edit more complex structures, although allowed, is tricky and might produce unexpected results.

 

Include

It's also possible to include other templates. This allows for reusing (parts of) templates. Examples of this include headers, footers, and banners. Having these in separate templates means you can edit them in one place and change them in all relevant messages at once.

Suppose 1040 is the ID of another template in the same account containing a shared footer. Code for including it would look like this:

<#include "1040">

Please note that Editable regions are disabled when using the Quick editor on the 'outer' template. This prevents accidental changes that affect other templates.

 

Link names

The SendPro, you can find the Top Links report under Reports - Flows - (your flow name). The Top Links box shows you the most clicked links from that flow. By default, the url of that link is shown. But what is you want to see more human-legible names in this overview? Simply add a data-name attribute to your links:

<a href = "https://yoururl.com" data-name = "sample link name">Click here</a>

Links with the same name are bundled in the Top Links report.

 

Special variables

There's a number of special variables available for use in SendPro message templates:

Variable Description Example Response type
${flowmailer.account.id} Your account id 1234 number
${flowmailer.account.description} Your account name MyAccount Production string
${flowmailer.source.id} ID of Source 1234 number
${flowmailer.source.description} Name of source used SendPro Webshop Source string
${flowmailer.flow.id} Id of flow used 1234 number
${flowmailer.flow.description} Description of flow used  SendPro Webshop Orders string
${receivedMessage.id} Unique message Id of the original message 201512161426489b63289c577efc89e2 string
${receivedMessage.type} Type of message (email or sms) EMAIL string
${receivedMessage.sender} Sender of the original message support@sendpro.com string
${receivedMessage.from} From of the original message SendPro Support <support@sendpro.com> string
${receivedMessage.recipient} Recipient of the original message support@sendpro.com string
${receivedMessage.subject} Subject of the original message New products! string
${receivedMessage.headers} Headers of the original message {"From":"example@example.com","Subject":"New products!","Content-Type":"text/html"} list
${currentMessage.id} Unique message Id of the current message 20250131095544ac7fa2a5560000ca9b string
${currentMessage.type} Type of message (email or sms) EMAIL string
${currentMessage.sender} Sender of the current message support@sendpro.com string
${currentMessage.from} From of the original message support@sendpro.com string
${currentMessage.recipient} Recipient of the current message firstname.lastname@spotler.com string
${currentMessage.subject}  Subject of the current message New products! string
${currentMessage.html} HTML code from the current message <div class=”myClass”>Your email text here</div> string
${currentMessage.text} Text version of the current message Your email text here string
${currentMessage.headers} Headers of the original message {"From":"example@example.com","Subject":"New products!","Content-Type":"text/html"} list
${inPreview??} Returns true if in Preview Screen FALSE Boolean

Functions and advanced use

Functions and advanced use Description Example Response type
<@addTags tags="a,b,c"/> Add searchable tags  
a tag, b tag and c tag
n/a
<@onlineLinkUrl/> Link to the archived version of the message http://web.flowmailer.net/viewonline.html?id=U-apInfGZkw:P8HCY(…)gBfk string
${onlineLinkUrl} Link to the archived version of the message http://web.flowmailer.net/viewonline.html?id=U-apInfGZkw:P8HCY(…)gBfk string
<@extractFromOriginal/> All the code between <html> and </html> <div class=”one”>Your email text here</div><div id=”two”>Another line here</div> string
<@extractFromOriginal selector="#someid" /> All the code in the selector (id in this example) Another line here string
<@extractFromOriginal selector=".one" /> Text version of all the code between <html> and </html> Your email text here Another line here string
${fetchMessage("20250131093217b3ea23d2e90000ca52")} Returns the data and headers of the message   list
${fetchMessageArchive("20250131093217b3ea23d2e90000ca52")} Returns the contents of the message   string
<@removeFromHtml selector="body" html="?" fragment="?" /> Removes the selected html   n/a
${toJson(.main)} Moves the current (json) variables to the global data, where they can be accessed by templates and flows   n/a
${toJson({"a":1})} Turns text into json {"a":1} string
${toJson(variableName)} Turns variable into json {"a":1} n/a
${fromJson('{"a":1}').a} Reads data from json 1 list
${fromJson('{"a":1}').a} Read data from XML 1 n/a
${parseHtml("<body><b>Hello world</b></body>")} Reads and parses the code as html Hello world string
${parseXml("<a>Hello world</a>")} Reads and parses the code as XML Hello world string
?fm.width Rescale image, force width example.jpg?fm.width=20 n/a
?fm.height Rescale image, force height example.jpg?fm.height=20 n/a
?fm.keep_aspect Rescale an image, keep proportions example.jpg?fm.width=20 &fm.keep_aspect=true n/a
<a href=”http://yourlink.com" data-noanalytics="true">link text</a> Excludes the link from the Analytics flowstep link text n/a
<a href="http://yourlink.com" data-notrack="true">link text</a> Excludes the link from the Link Tracking flowstep link text n/a
<a href="http://yourlink.com" title="link name">link text</a> Uses the Link Name in the top 10 clicked links list in the Dashboard link text n/a
<a href="http://yourlink.com" title="undesired link name" data-name="link name">link text</a> Uses the Data Name in the top 10 clicked links list in the Dashboard link text n/a

Encoding (advanced users only)

Encoding Description Example Response type
${hash("SHA-1", "data to hash")} Returns a hashed variable 5e9899f21fffa2ee8b16be78038dd886305e3f82 string
${hashb64("SHA-1", "ZGF0YSB0byBoYXNo")} Returns a base 64 hashed variable 5e9899f21fffa2ee8b16be78038dd886305e3f82 string
${hmac("HmacSHA1", "data to hmac", "key")} Returns a HMAC hashed variable 0aef055a2c2c9da492d977fe30e4ee84f3b86959 string
${hmacb64("HmacSHA1", "ZGF0YSB0byBobWFj", "a2V5")} Returns a HMAC base64 hashed variable 0aef055a2c2c9da492d977fe30e4ee84f3b86959 string
${b64encode("data to base64 encode", "UTF-8")} Encode text as UTF8 - base64 ZGF0YSB0byBiYXNlNjQgZW5jb2Rl string
${b64decode("ZGF0YSB0byBiYXNlNjQgZW5jb2Rl", "UTF-8")} Decode text from UTF8 - base64 data to base64 encode string
b64decode(“string“, “type“) If type is not set, defaults to ASCII

${b64decode("xyz", "UTF-8")}

${b64decode("xyz", "ASCII")}

n/a

Event variables

Variable Description Example
event.received Event received (timestamp) 2021-07-29T08:51:26.039Z
event.type Type of event OPENED
event.data Data from message 1234
event.message.id ID of event 12345abcd
event.message.type Type of message EMAIL
event.message.sender Sender of message sender@sendpro.com
event.message.recipient Recipient of message recipient@sendpro.com
event.message.subject Subject of message Lorem ipsum dolor sit amet
event.message.from From header email address sender@sendpro.com
event.message.headersIn Original headers received ['Content-Transfer-Encoding']
event.message.headersOut Headers sent out ['Content-Transfer-Encoding']