Skip to content
English
  • There are no suggestions because the search field is empty.

Conditional Logic (If/Else Statements)

Here we learn how to send a different message depending on the customer criteria of your choice, using if/else statements

If/else statements are used to change the content of your message depending on different variables that relate to your customer. This means that by using code, you can say different things, depending which customer is receiving the message. 

Remember, we now have a criteria builder so we can send different flow steps to customers of your choosing. However, it is also handy to have the option to edit your SMS or email so that the same message is sent to everyone with differing content.


The example below asks the system “if the customer’s name is John” then action a certain thing

{% if customer.first_name == "John" %} 

Any if statement always needs to be ended as per below so we would add this so the end of the code

{% endif %}

So the code below would say your name is John to those with that name and those called anything else would not receive a message.

{% if customer.first_name == "John" %} Your name is John! {% endif %}

We can also give an alternative. So if the customer’s name is not John we can output a different message. So the example below would be the whole if/else statement that we would input.

{% if customer.first_name == "John" %}Your name is John!{% else %}Your name is not John.{% endif %}

In this case you would either receive “Your name is John!” or “Your name is not John”


Where this might be useful

If a customer is sitting in the stalls you might want to tell them to come in a different door to everyone else. So you would say if you are sitting in stalls please come in the south entrance. For everyone else it would say please come in the north entrance.


Here is an example of adding a different message to those with VIP tickets.

{% if "VIP" in ticket_types %} Please remember to collect your complimentary drink before the show {% endif %}


We know this can feel complicated but we can always help you work out the easiest way to create the messaging you want.
If you'd like us to help build custom templates please contact  support@crowdengage.com.

It is important to check the codes you are using within your logic to make sure that this is correct for crowdEngage. We can guide you how to utilise this properly and would always encourage testing before sending live to customers.