Filters can be used to augment fields.
They are referenced inside of fields using the following format:
{{ field_name | FILTER }}
They can be chained together if needed.
{{ field_name | FILTER1 | FILTER2 }}
Some filters, accept parameters, in that case, you can use the following syntax:
{{ field_name | FILTER: PARAMETER }}
For example, if you would like to give a 3-hour time window to your clients in the message based on the start time, then you could use the following as your template:
Your installer will be arriving between {{ event.start_time | time }} and {{ event.start_time | add_minutes: 180 | time }}
In the above example… the first field uses the time
filter to change the event.start_time
from something that looks like “2016-06-06 14:00:00 -0700” to “2:00 PM”. The second field uses the add_minutes
filter to add 180 minutes to the start_time and then output the time, so in this case, it would result in “5:00 PM”. So the result would be:
Your installer will be arriving between 2:00 PM and 5:00 PM
The liquid templating language comes with a set of filters out of the box (https://github.com/Shopify/liquid/wiki/Liquid-for-Designers).
Apptoto adds and enhances some of the filters.
The following filters are designed to work specifically with the {{ event.start_time }} and {{ event.end_time }} fields
Date Filters
Filter | Description |
---|---|
date | Apptoto enhances this filter by properly formatting the date based on your locale. So if you use the “%A” format for example, it will say “Sunday” if your locale is set to English, and “Domingo” if your locale is set to “Spanish”. The Locale is set on your “Account” tab. i.e. its “(localized)”. |
date_full | Date format filter that changes the date to say “Tuesday, October 15th” . (localized) |
date_and_time_full | Date format filter that changes the date to say “Tuesday, October 15th at 2:00pm “ . (localized) |
date_phrase | Date format filter that changes the date to say “6/21” . (localized) |
date_with_year | Date format filter that changes the date to say “6/21/1977” . (localized) |
day_with_date | Date format filter that changes the date to say “Wednesday the 30th July 2012”. (localized) |
time | Date format filter that changes the date to say “3:00pm” . |
time_24 | Date format filter that changes the date to say “15:00” . |
day_and_time | Date format filter. Results in “tomorrow at 8:00am” if the date is tomorrow or “on Saturday, November 23rd at 2:00pm” if the date is after that. |
tomorrow | Advances the date forward one day. e.g. {{event.start_time | tomorrow | date_full}} would result in “Wednesday, October 16th”. |
yesterday | Retreat the date backwards one day e.g. {{event.start_time | yesterday | date_full}} would result in “Monday, October 14th”. |
beginning_of_week | Finds the monday immediately before the date provided. |
add_minutes | Advances the time forward by N minutes. e.g. {{ event.start_time | add_minutes: 30 | date: "%l:%M %p"}} would result in “4:30 pm” if the start time of the appointment was at 4:00pm. |
browser_time | Shows the time to the user in the time zone of the browser. This is only available on the “Appointment Page”. e.g. {{ event.start_time | browser_time }} would result in showing the time to the client in their time zone. |
browser_date_and_time | Same as browser_time except it include the date. |
String Filter
Filter | Description |
---|---|
default | Allows you to specify a default for a field. e.g. {{ event.data.service | default: 'Haircut' }} would result in “Haircut” being used in the message if the event didn’t have the service specified. This is actually applicable for all types of data (not just strings), but is mostly used for strings. |
everything_before | Extracts everything before a character in a string. e.g. if you put “haircut – fred” in the titles and want Apptoto to include everything before the “-” in the message, then you could use:{{ event.title | everything_before: "-" }} |
everything_after | Same as everything_before but includes everything after |
say_digits | Tells the text to speech engine to say individual digits, not whole numbers. E.g. {{ participant.phone | say_digits }} |
capitalize | Capitalizes the string by making the first letter of the first word upper case |
line_after | Finds the line after a string. e.g. {{ event.content | line_after: 'Send To:' }} |
lines_after | Finds N lines after a string. e.g. {{ event.content | lines_after: 'Send To:', 2 }} would find the 2 lines after the line containing “Send To” in it. |
play_mp3 | Calls only. Plays whatever mp3 file you link to during the call. E.g. {{ 'https://api.twilio.com/cowbell.mp3' | play_mp3 }} |
pause | Calls only. Pauses for X seconds. E.g. {{ '3' | pause }} will pause for 3 seconds |
html_to_text | Converts html to text. |