Knowledge Base

⌘K
  1. Home
  2. Docs
  3. Knowledge Base
  4. Message Setup
  5. Message Templates
  6. Conditional Logic

Conditional Logic

For information regarding our Conditional Blocks feature of the Auto Messages tab, please view the Conditional Blocks section here.

Conditional logic can be used in your message templates and appointment pages to include or exclude certain parts of the message.

For example, if you want include a special message for appointments that are after 5pm, your message template could be:

Appointment Reminder:  This is your reminder for your appointment {{ event.day_and_time_phrase }}.  {% if event.time_hour >= 17 %}Please note that the office closes promptly at 6pm.{% endif %}

This setup will include the “Please note that the office closes promptly at 6pm” ONLY in messages to appointments that start after 5pm

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 %}

Conditions

Conditions are in the format

FIELD OPERATOR OPERAND

or for boolean fields, you can test if a field is true by just putting

FIELD

Operators

OperatorDescription
==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.
includesString includes a certain word or phrase. e.g. if event.title includes 'rain'. Includes is not case sensitive and only matches words by themselves (i.e. it would not match “raindrop”, but it would match “time for rain”)
does_not_includeString does not include a certain word or phrase.
containsString 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_containsString does not contain a certain string.
starts_withString 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_withString does not start with a specific string. Not case sensitive.
ends_withString does 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_withString does not end with a specific string. Not case sensitive.

To test something against an empty string, use the phrase “blank”. e.g. if participant.all_responses == blank would be true if the participant hadn’t responded to any messages.

Boolean Operators

Boolean operators 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 %}
OperatorDescription
andCondition A and Condition B
orCondition A or Condition B