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 the same message that you write can say different things, depending who is receiving it.
Remember, we now have a template that makes it slightly easier to send messages to different customers. However, we know some customers like having one message for everyone so this is where using the code comes in handy!
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
For example if the 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.
You could also use this feature if you wanted to be a bit more formal towards your customers sitting in the VIP section.
{% if ticket.area == “VIP” %} Dear customer.first_name customer.last_name{% else %} Hi customer.first_name {% endif %}
This would mean VIP customers would receive (for example) Dear John Smith, however all other customers would receive “Hi John”
We know this can be complicated, so we also have the criteria option within the text template to send different flow steps to different customers. If you want us to help decide the best method to use, don't hesitate to drop us a line at support@crowdengage.com