Inserting dynamic content in workflows
Workflow emails can be customized to include dynamic content, such as the recipient's name and details about the event. In this guide, we'll walk through how to work with dynamic variables.
Variables
SavvyCal uses Liquid, a template language invented by Shopify. Liquid is powerful and flexible, but don't be intimidated! Most of the time, you'll just be inserting variables (like the recipient's first name), which does not require any special technical knowledge. If you encounter a more complex scenario (such as needing to add conditional logic), Liquid can handle it -- but you can cross that bridge when you get there.
Liquid variables look like this:
{{ recipient.display_name }}
That's two open braces ( {{
), followed by the name of the variables, and ending with two closing braces (}}
).
When editing the body of an email, you can access a quick reference of the variables available under the { } Variable menu:
You may click the variable in the menu to insert it in the email at the current cursor position.
Filters
Sometimes, you need to modify a variable in some way to make it display how you want in an email. A common example is dates and times. There are many different ways to format a time - here are a few examples:
- Long: June 1, 2022, at 5:00:00 AM CDT
- Medium: Jun 1, 2022, 5:00:00 AM
- Short: 6/1/22, 5:00 AM
Filters in Liquid help you transform variables in the format you need! If you look at our simple reminder template, you'll notice a few variables that look different than the rest:
These are both examples of filters. Let's look at the first example:
{{ event.start_at | datetime: "long" }}
This is taking the event.start_at
variable and applying the datetime
filter (specifically, with the "long"
format). Don't worry, we have a quick reference of these common filters, so don't feel like you need to memorize all this!
Formatting datetimes
Use the datetime
filter to format event date/times. You can supply either "full"
, "long"
, "medium"
, or "short"
to the filter, depending on how long you'd like the description to be. (Typically, you'll want to use "long"
).
{{ event.start_at | datetime: "long" }}
Format | Example |
---|---|
full |
Wednesday, June 1, 2022 at 5:00:00 AM GMT-05:00 |
long |
June 1, 2022 at 5:00:00 AM CDT |
medium |
Jun 1, 2022, 5:00:00 AM |
short |
6/1/22, 5:00 AM |
Displaying times in a specific time zone
By default, we show times in known the time zone for the recipient, so you generally don't need to use this. But in the event that you want to guarantee showing the time in a particular time zone, use the in_time_zone
filter. This filter accepts an Olson time zone name (e.g. "America/Chicago" for US Central Time, "America/Los_Angeles" for US Pacific Time, etc.).
{{ event.start_at | in_time_zone: "America/Los_Angeles" | datetime: "long" }}
Showing the amount of time until an event starts
In reminder emails, you'll often want to show how many days/hours/minutes are left until an event starts (e.g. "This event starts in 3 hours"). Use the relative_to
filter for this.
This event starts {{ event.start_at | relative_to: "now" }}
Building hyperlinks
We have a handy filter for taking a URL and converting it to a hyperlink. For example, the following tag will take the event URL and transform it into a hyperlink:
{{ event.url | hyperlink: "Reschedule or cancel" }}