Skip to main content

I am trying to set up a journey to send a specific email treatment if that email is being sent Tues-Thurs between 11am and 4pm.

For context, we have a new chat function that we are testing on our website that we want to send people to via a link in an email, however, our agents are only able to monitor this chat Tues-Thurs between 11am to 4pm. So if a customer is set to receive that email outside of that time frame, we want to send the regular email that does not direct them to our chat function. 

Does anyone have experience with sending a different treatment during specific time frame? I have not found a solution with the support team so I thought I would see if anyone has experience with the same type of thing. 

Thanks!

Hey ​@paigehendy!

 

I know Iterable Support has a few contributors to the Plaza so I defer to them, but to me it seems like you should be able to pull and assign the day of week and hour of day date parts from the now() timestamp and use those and some handlebars to conditionally render the correct treatment to your users.

 

The solution should look something like the following:

 

<!-- Assign day of week; returns an integer corresponding to the day of week -->
{{#assign dayOfWeek}}
{{dateFormat now format="u" tz="America/Los_Angeles"}}
{{/assign}}

<!-- Assign hour of day; returns an integer corresponding to the hour of the day -->
{{#assign hourOfDay}}
{{dateFormat now format="k" tz="America/Los_Angeles"}}
{{/assign}}

<!-- Conditional logic for rendering HTML with/without chat snippet -->
{{#ifGte dayOfWeek 2}}
{{#ifLte dayofWeek 4}}
{{#ifGte hourOfDay 11}}
{{#ifLte hourOfDay 15}}
HTML WITH CHAT SNIPPET HERE
{{else}}
HTML WITHOUT CHAT SNIPPET HERE
{{/ifLte}}
{{/ifGte}}
{{/ifLte}}
{{/ifGte}}

 

I wrote this without any testing on my side so there could be some bugs, but it should lead you down the right path in terms of how you can use #dateFormat and #assign to isolate the date parts you need and use them within your conditional rendering logic.

 

Hit reply and let me know how it works for you! Happy to answer any follow ups you might have.


@paigehendy If you still need assistance with this after testing out the above solution provided by ​@drakeballew please don’t hesitate to email support@iterable.com to assist further! I know you mentioned support wasn’t able to come up with a solution, but we can continue to work with you until this is resolved.


Reply