Skip to main content
Liquid Syntax

Dynamically Change Your Email Copy Based on Date & Time with Liquid Syntax

Updated over 4 months ago

There are a few ways you can use liquid syntax in your emails.

Greetings based on the local time

  • “Good morning {{firstName}}” if it’s before 12 PM

  • “Good afternoon {{firstName}}” if it’s between 12 PM - 3 PM

  • “Good evening {{firstName}}” if it’s after 3 PM

Good {% assign time_h = 'now' | date: '%H%M' %} {% if time_h < 1200 %}morning {% elsif time_h < 1500 %}afternoon {% else %}evening {% endif %} {{firstName}}

Greetings based on the day of the week

  • “Hope you are having a good start to the week” if it’s between Monday and Wednesday.

  • “Hope you are having a good week” if it’s between Wednesday and Sunday.

{% assign today = 'now' | date: '%s' %}{% assign single_day = 86400 %}{% assign today_number = 'now' | date: '%u' | plus: 0 %}{% if today_number < 4%}Hope you're having a good start to the week.{% else %}Hope you're having a good week.{% endif %}

Greetings based on the day of the week

  • "Hello Tuesday" if the day is Tuesday.

  • "Happy Friday" if the day is Friday. ​

{% assign handle = 'now' | date: '%A' %}{% case handle %}{% when 'Monday' %}It's Monday!{% when 'Tuesday' %}Hello Tuesday{% when 'Wednesday' %}Hi Wednesday{% when 'Thursday' %}It's Thursday!{% when 'Friday' %}Happy Friday!{% endcase %}

Meetings based on the day of the week

  • “Are you available anytime this week?” if it’s between Monday and Wednesday.

  • “Are you available anytime next week?” if it’s between Wednesday and Sunday.

{% assign today = 'now' | date: '%s' %}{% assign single_day = 86400 %}{% assign today_number = 'now' | date: '%u' | plus: 0 %}{% if today_number < 4%}Are you available anytime this week?{% else %}Are you available anytime next week?{% endif %}

Inserting the day of the week

  • “Monday” if it’s Monday

  • “Tuesday” if it’s Tuesday

{# "now" | date: "%A" #}

Inserting yesterday's date

  • "March, 21 2023" if today is March 22 2023

Hey, yesterday date is: {# 'now' | date: '%s' | minus: 86400 | date: '%B %d, %Y' #}

Current month

{# "now" | date: "%B" #}

Use conditionals with variables

You can use lead variables and logic definitions in syntax. The system variables available are:

  • sendingAccountName

  • sendingAccountFirstName

  • sendingAccountEmail

  • sequence_email_opened - boolean

Assuming the lead has a variable called position that is set to "founder":
{% if position == "founder" %} As founder, you have to learn to delegate. {% endif %}

You can watch the instructional video about liquid syntax by clicking the link here.

Did this answer your question?