Skip to main content
Solved

Sending different text messages depending on the time of the event

  • October 29, 2022
  • 1 reply
  • 97 views

We want to trigger and automatic text message when a user submits a form. We have an Event for this and it triggers a Campaign. The Campaign sends a message such as “Thank you for applying….” 

 

We’d like to change the copy of this message depending on the time of the day (as well as if weekend or not).

 

It seems like the only possible way is to add a ts attribute to the customer via liquid, and then create 3 separate messages with complex exclusion rules in liquid.

 

Is there an easier way to change up the message depending on the time at which the Event was triggered?

Best answer by computer_smile

Can you try something like this? Where you take the current day hour when you want to send the message and set up conditionals based on those numbers. Example:

{% assign day_hour = "now" | date: "%H" | abs %}

{% if day_hour  >= 0 and day_hour  < 12 %} 

 Good morning 

{% elsif day_hour >= 12 and day_hour < 16 %}   

 Good afternoon

{% elsif day_hour >= 16 and day_hour  < 25 %}  

 Good evening

{% else %}  

 G'day 

{% endif %}

 

I think all the data is there to use one message but conditionals may get messy when adding weekend logic. 

 

View original
Did this topic help you find an answer to your question?

1 reply

computer_smile

Can you try something like this? Where you take the current day hour when you want to send the message and set up conditionals based on those numbers. Example:

{% assign day_hour = "now" | date: "%H" | abs %}

{% if day_hour  >= 0 and day_hour  < 12 %} 

 Good morning 

{% elsif day_hour >= 12 and day_hour < 16 %}   

 Good afternoon

{% elsif day_hour >= 16 and day_hour  < 25 %}  

 Good evening

{% else %}  

 G'day 

{% endif %}

 

I think all the data is there to use one message but conditionals may get messy when adding weekend logic. 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings