Conditional Logic
Use conditional logic in Apptoto message templates and appointment pages to further customize message templates and appointment pages.
Conditional logic can be used in your message templates and appointment pages to include or exclude certain parts of the message.
Use {% if %} blocks to include or exclude content based on appointment or participant data.
Syntax
Section titled “Syntax”Conditional logic is in the following format:
{% if CONDITION %} CONTENT {% endif %}or
{% if CONDITION %} CONTENT {% else %} ALTERNATE {% endif %}or
{% if CONDITION %} CONTENT {% elsif CONDITION2 %} CONTENT2 {% endif %}Example
Section titled “Example”If you would like to add a note to your message only when the appointment is in the evening, you could use:
Your appointment is {{ event.day_and_time_phrase }}.{% if event.time_hour >= 17 %}Please note that the office closes promptly at 6pm.{% endif %}The “Please note…” sentence will only appear when the appointment starts at 5pm or later.
Conditions
Section titled “Conditions”Conditions are in the format:
FIELD OPERATOR OPERANDFor boolean fields, you can test if a field is true by just putting:
FIELDOperators
Section titled “Operators”| Operator | Description |
|---|---|
== | Exact equals. For example, for boolean fields, participant.first_appointment_of_the_day true would be true if the appointment was the first appointment of the day. Or event.all_day false would be true if the appointment was not an all-day appointment. |
!= | Is not equal. For example, participant.confirmed != true would be true if the participant had not confirmed. |
> | Greater than. Useful for number fields. e.g. if event.time_hour > 12 would be true if the appointment was in the afternoon. |
>= | Greater than or equal. Useful for number fields. |
< | Less than. Useful for number fields. |
<= | Less than or equal. Useful for number fields. |
includes | String includes a certain word or phrase. e.g. if event.title includes 'rain'. Includes is not case sensitive and only matches whole words (i.e. it would not match “raindrop”, but it would match “time for rain”). |
does_not_include | String does not include a certain word or phrase. |
contains | String contains a certain string. Not case sensitive. Matches any string, even if the string is inside another string. e.g. if event.title contains 'rain' would match “raindrops”. |
does_not_contain | String does not contain a certain string. |
starts_with | String starts with a specific string. Not case sensitive. If the keyword were pump, it would match the selected field if it were pumpkin. |
does_not_start_with | String does not start with a specific string. Not case sensitive. |
ends_with | String ends with a specific string. Not case sensitive. If the keyword here were kin, it would match the selected field if it were pumpkin. |
does_not_end_with | String does not end with a specific string. Not case sensitive. |
Boolean Operators
Section titled “Boolean Operators”Boolean operators and and or can be used to generate complex logic, e.g.:
{% if event.title starts_with 'call:' and event includes 'conference' %}Please use the conference line provided to join the conference.{% endif %}| Operator | Description |
|---|---|
and | Condition A and Condition B |
or | Condition A or Condition B |