Snippets can be templated to insert custom data automatically at the point of insertion. Templates start with "{{" and end with "}}". Spaces are not allowed within the fill-in.
Here are some examples of the templates supported. Upon insertion, you'll notice that the templates are swapped with the actual values:
- {{ first_name }} -> John
- {{ last_name }} -> Doe
- {{ date }} -> Feb 01
- {{ choice ["Phrase 1", "Phrase 2", "Phrase 3"]}} -> will randomly pick a phrase to insert
Unspecified Templates
If a particular template does not have a fill-in value, Sapling will highlight it with a blue bounding box as a reminder that it should be filled prior to sending.
Note that while Sapling uses curly braces for templates, you can optionally use square brackets to distinguish values that should be filled in as well.
Using with Platforms
Some platforms support an existing set of template fill-ins.
For example, on Zendesk you can use {{ticket.requester.first_name}} in a snippet. Once that message is sent, Zendesk will fill in the relevant values.
Custom Date Formats
The {{ date }} template supports custom format specifications. Here are some examples of supported formats. For custom formats, look at the "Date Format Parameters" section below.
- {{ date %Y-%m-%d }} -> 2018-02-21
- {{ date %B %-d }} -> February 21
Date Format Parameters
%Y: Returns the year in four-digit format. For example: 2018.
%y: Returns the year in two-digit format. For example: 18 (for 2018).
%B: Returns the full name of the month, e.g. September.
%b: Returns the first three characters of the month name, e.g. "Sep".
%m: Returns the month as a number, from 01 to 12 (zero padded).
%-m: Returns the month as a number, from 1 to 12.
%d: Returns day of the month, from 01 to 31 (zero padded).
%-d: Returns day of the month, from 1 to 31.
%A: Returns the full name of the weekday, e.g. Wednesday.
%a: Returns the first three characters of the weekday, e.g. Wed.
%H: Returns the hour, from 01 to 24 (zero padded).
%-I: Returns the hour, from 1 to 12 .
%M: Returns the minute, from 00 to 59.
%S: Returns the second, from 00 to 59.
%p: Returns AM/PM for time.
Comments
0 comments
Article is closed for comments.