Get started

Snippet templates and fill-ins

Updated

Snippets can include templates, also called fill-ins or placeholders, that Sapling fills in when you insert the snippet. A template starts with {{ and ends with }}. Type template names exactly as shown below, with at most one space after {{ and before }}.

When you insert a snippet, Sapling replaces each template with its value:

Template Inserts Example
{{ first_name }} The first name on your Sapling account John
{{ last_name }} The last name on your Sapling account Doe
{{ date }} Today's date Feb 01
{{ choice ["Phrase 1", "Phrase 2", "Phrase 3"] }} One of the phrases, picked at random Phrase 2

In a choice template, put each phrase in double quotes and separate the phrases with commas.

Fill-ins to complete by hand

Sapling highlights a fill-in that it can't fill in, such as {{ order_number }}, with a blue box. This reminds you to replace it before you send the message. You can also use double square brackets, such as [[order number]], to mark text that you need to fill in.

A highlighted fill-in in an inserted snippet

Using with other platforms

Some platforms have their own placeholders. For example, on Zendesk you can put {{ticket.requester.first_name}} in a snippet. Zendesk fills in the value when the message is sent.

Custom date formats

The {{ date }} template accepts a custom format. For example:

  • {{ date %Y-%m-%d }} inserts 2018-02-21
  • {{ date %B %-d }} inserts February 21
  • {{ date %-I:%M %p }} inserts 3:05 PM

Date format parameters

Parameter Returns Example
%Y Year, four digits 2018
%y Year, two digits 18
%B Full month name September
%b Short month name Sep
%m Month number, 01 to 12 09
%-m Month number, 1 to 12 9
%d Day of the month, 01 to 31 05
%-d Day of the month, 1 to 31 5
%A Full weekday name Wednesday
%a Short weekday name Wed
%H Hour, 00 to 23 15
%I Hour, 01 to 12 03
%-I Hour, 1 to 12 3
%M Minute, 00 to 59 05
%S Second, 00 to 59 09
%p AM or PM PM