Solved

Sending different text messages depending on the time of the event

  • 29 October 2022
  • 1 reply
  • 72 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?

icon

Best answer by computer_smile 1 November 2022, 22:06

View original

1 reply

Userlevel 1

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