Table of Contents
Overview
Advanced Snippets are somewhat different from Basic Snippets in that they allow for limited conditional logic.
That means Advanced Snippets can provide a fallback in the event that there is no data for a specific field for a contact. This allows you to avoid having emails shipped to the Not Sent folder when you try to reach a contact with a snippet for which Apollo has no data.
Refer to the sections below for how to use all of the different types of Advanced Snippets supported in Apollo email templates.
Types of Advanced Snippets
Advanced snippets come in several different flavors:
- Empty Fallback
- Dynamic Fallback
- Letter Case and Pluralization Operators
- Now-date/time Operators
- Custom Date Operators
Each of these Advanced Snippet types allows you to further personalize email templates for your customers.
Advanced Snippets With an Empty Fallback
The first type of Advanced Snippets allow you to send templated emails to recipients without the fear of having them end up in the Not Sent folder when a Basic Snippet does not render because of a lack of available data. In short, Advanced Snippets with an empty fallback do not print any personalized text if it is not available in the Apollo database.
Imagine that you want to send an email that greets each recipient by their first name. In order to accomplish that, you might decide to use the {{first_name}}
snippet to say something like:
Greetings {{first_name}},
If one of the contacts in your sequence does not have a first name in the Apollo database, the snippet will fail and the email will be moved to the Not Sent folder.
To avoid this, you could use the Advanced snippet {{#if first_name}}{{#endif}}
to create a generic fallback:
"Greetings {{#if first_name}}{{#endif}},
For recipients with first name data in the Apollo database, the snippet will render in the email like this:
Greetings John,
Recipients without first name data in the Apollo database will receive an email that renders like this:
Greetings ,
Advanced Snippets With a Dynamic Fallback
Advanced Snippets with a dynamic fallback go one step further than the empty fallback variety and print text that you define in the event that there is no data for a particular field when a recipient opens a sequence email.
Continuing with the scenario above, imagine that you want to use generic text in place of a recipient's first name if it is not available. If we use the following snippet:
Hi {{#if first_name}}{{first_name}}{{#else}}there{{#endif}},
The email will render like the example below if no first name data is available on open:
Hi there,
If the recipient does have first name data available, the email will still render like this:
Hi John,
It's important to understand what each part of the snippet does. The first part, {{#if first_name}}{{first_name}}
, is the start of the conditional logic. It tells Apollo, "If there is a value for first name, render that first_name value in the opened email." This is similar to what the Basic Snippet {{first_name}}
does with the exception of the inclusion of an {{#if}}
statement.
The next part,{{#else}}there
tells Apollo "If no first name value is available for this contact, use the text there
instead.
The final part, {{#endif}}
tells Apollo that this is the end of the conditional logic for this snippet.
Advanced Snippets With Letter Case and Pluralization Operators
Advanced Snippets with letter case and pluralization operators take the value of a field and change the case or the pluralization.
Please note, these Advanced Snippet types only work on string
type fields. They will not work for other field types.
Examples
Snippet | Description | Example |
---|---|---|
{{title->lowercase} |
Takes the value of a contact's title and converts every letter in it to lowercase | Engineering Manager becomes engineering manager |
{{title->capitalize_each_word}} |
Takes the value of a contact's title and converts the first letter in every word to lowercase | engineering manager becomes Engineering Manager |
{{title->plural}} |
Takes the contact's title and converts it to the plural form | Engineering Manager becomes Engineering Managers |
You can combine multiple case and pluralization operators in a single Advanced Snippet:
{{title->capitalize_each_word->plural}}
In the opened email, this snippet renders the title engineering manager
as Engineering Managers
.
Advanced Snippets With Now-Date/Time Operators
Advanced Snippets with {{now_month}}
, {{now_day}}
, and {{now_time}}
operators take the current date and manipulate it in various ways.
Please note, these Advanced Snippet types only work on date
field types. They will not work for other field types.
Examples
Snippet | Description | Example |
---|---|---|
{{now_day->plus_X}} |
Takes the current day and moves it forward by the specified number of days. You can use any whole number (integer ) here. |
If is currently the 15th day of the month, an email that includes the snippet {{now_day->plus_10}} will render as 25 in the opened email. |
{{now_month->minus_X}} |
Takes the current day and moves it backward by the specified number of days. You can use any whole number (integer ) here. |
If is currently the 10th day of the month, an email that includes the snippet {{now_day->minus_5}} will render as 5 in the opened email. |
{{now_month->plus_X}} |
Takes the current month and moves it forward by the specified number of months. You can use any whole number (integer between 1 and 11 here. |
If the current month is September, an email that includes the snippet {{now_month->plus_1}} will render as October in the opened email |
{{now_month->minus_X}} |
Takes the current month and moves it backward by the specified number of months. You can use any whole number (integer ) between 1 and 11 here. |
If the current month is September, an email that includes the snippet {{now_month->minus_2}} will render as July in the opened email |
{{now_year->plus_X}} |
Takes the current year and moves it forward by the specified number of years. You can use any whole number (integer ) here. |
If the current year is 2021, an email that includes the snippet {{now_year->plus_2}} will render as 2023 in the opened email |
{{now_year->minus_X}} |
Takes the current year and moves it backward by the specified number of years. You can use any whole number (integer ) here. |
If the current year is 2021, an email that includes the snippet {{now_year->minus_5}} will render as 2016 in the opened email |
{{now_time_of_day}} |
Displays the current stage of the day (morning , afternoon , evening ) |
Adding Good {{now_time_of_day}}, to the body of your email template will render as Good morning, if someone opens the email at 9:00am. |
Advanced Snippets With Custom Date Operators
Please note, custom fields and snippets that leverage custom date operators are only available for customers on Basic, Professional, and Custom plans. If you would like to upgrade your plan, please reach out to the Apollo Sales team.
Advanced Snippets with custom date operators make use of custom fields configured for dates and manipulate them in various ways.
Please note, these Advanced Snippet types only work on date-type fields. They will not work for other type fields.
Imagine that you have created a custom field for the date of your yearly product announcement that takes place on October 19, 2021 called Product Announcement
. Since that custom field includes a month, day, and a year, you can use custom date operators in a snippet to extract specific pieces.
The snippet {{product_announcement->day}}
renders as 19
in the opened email. If you used the snippet {{product_announcement->month}}
, it renders as October
in the opened email. The snippet {{product_announcement->year}}
renders as 2021
in the opened email.
In addition, you could use the snippet {{product_announcement->weekday}}
to extract the day of the week for your custom date. In this instance, it renders as Tuesday<
in the opened email since October 19, 2021 falls on a Tuesday.
Example Use Case For Advanced Snippets
For additional context, take a look at a real world example of how to use Advanced Snippets in your email template. Within an Automatic Email task, we created an email template with body copy that leverages several different Advanced Snippet types.
Please note, we formatted the text in the example below with code formatting to offset the snippets from the plain-text copy and line breaks between each conditional logic statement for ease of reading. In an actual snippet for an Apollo sequence task, you should write a snippet as one continuous line.
Hi
{{#if first_name}}{{first_name}}{{#else}}there{{#endif}}
,We know many companies like
{{#if industry == Marketing}}Sparks, Jumpshot, and Deepcrawl {{#else}}{{#if industry == Big Data}}Heap Analytics, Palantir, and KeenIO {{#else}}Snowflake Computing, Uber, and Lyft{{#endif}}{{#endif}}are looking for new tools to implement for {{now_year->plus_1}}, and we'd like to walk you through our platform to have a good understanding of our full capabilities. Does
{{now_weekday->plus_2}}
or{{now_weekday->plus_3}}
{{now_time_of_day}}
work for you?
Take a look at each of the individual snippets and what they're doing in the email template:
Nested Snippets Pointing to Specific Field Values
To begin, the {{#if first_name}}{{first_name}}{{#else}}there{{#endif}}
snippet sets up a fallback for first name to render as there
in the event that there is no first name data available for the recipient who opens the email.
The {{#if industry == Industry Marketing}}Sparks, Jumpshot, and Deepcrawl
portion of the snippet tells Apollo to render the text as Sparks, Jumpshot, and Deepcrawl
if the Industry field for the recipient who opens the email is Marketing
. If the industry is not Marketing
, Apollo moves on to the next piece of conditional logic.
The next portion of the snippet, {{#else}}{{#if industry == Big Data}}Heap Analytics, Palantir, and KeenIO
, tells Apollo to render the text as Heap Analytics, Palantir, and KeenIO
if the Industry field for the recipient who opens the email is Big Data
. If the Industry is not Marketing
or Big Data
, Apollo moves on to fallback portion of the conditional logic.
The snippet {{#else}}Snowflake Computing, Uber, and Lyft
is the fallback if the recipient's Industry field does not match Marketing
or Big Data
. In this instance, the text renders as Snowflake Computing, Uber, and Lyft
in the opened email.
The final portion of the snippet, {{#endif}}{{#endif}}
, closes the conditional logic. Two {{endif}}
statements are required since there are nested {{#if}}
statements.
{{endif}}
statements do I need?As a rule of thumb, for each {{#if}}
statement in your snippet, you need a corresponding {{#endif}}
to close the snippet.
Now-Time Snippets
Continuing through the body copy, the snippet {{now_year->plus_1}}
tells Apollo to take the current year 2021
and add one year to it. When the recipient opens this email, this text renders as 2022
.
Next, the snippet {{now_weekday->plus_2}}
tells Apollo to take the current day of the week and advance it by two days. If Apollo sends the email on a Monday, the text in the email renders as Wednesday
. If Apollo sends the email on a Tuesday, the text renders as Thursday
and so forth. If Apollo send this email on a Thursday or Friday, the text will render the snippet as Monday
because it is the next available weekday.
Subsequently, the {{now_weekday->plus_3}}
snippet tells Apollo to take the current day of the week and advance by three days. If Apollo sends the email on a Tuesday, the text in the email will render as Friday
. If Apollo sends the email on a Wednesday, the text renders as Monday
. Apollo renders the snippet as the next available work day if the day of the week specified by the snippet falls on a weekend day.
Finally, the {{now_time_of_day}}
tells Apollo to display the time of day for the recipient based on their local time in their local timezone (when it is available) and renders morning
, afternoon
, or evening
.
Comments
0 comments
Article is closed for comments.