Ok, I see a couple of items to consider and work with now that I have a better understanding of your use case
- What
DAY
is the next available window per TCPA settings? → Data Flow using Calendar Search
- If 1) is after the weekend or a holiday, prevent the 72hr notification from firing at the same time
- Use the time of day of the initial notification message to send the subsequent notifications
Alright, let’s get to it.
Calendar Search
You can find the next available Firing DateTime by performing a Calendar Search data operation.
Let’s look for the next firing date 48hr from NOW()
:
This data operation, ran on a Friday, observing TCPA will return (Monday 8am, PST):
{
"start": {
"date": {
"year": 2022,
"month": 6,
"day": 13
},
"time": {
"hour": 15,
"minute": 0,
"second": 0,
"millisecond": 0
},
"timeZone": "UTC"
},
"end": {
"date": {
"year": 2022,
"month": 6,
"day": 13
},
"time": {
"hour": 15,
"minute": 0,
"second": 0,
"millisecond": 0
},
"timeZone": "UTC"
},
"bookingInfo": null
}
Building our Data Processing
Now we understand how the Calendar Search works, and what data is made available so as to set up a Variable that holds the data, which can then be used to set up the Timers to fire the 48hr and the 72hr notification.
Because we need to use the Calendar Search data operation the processing will need to be done in a Data Flow (as opposed to a UDF, or directly in the Set Variable’s Value property).
Here’s what we need to do:
- Calculate the 48hr notification firing dateTime, using
NOW() + 2 days
- Calculate the 72hr notification firing dateTime, using the
48hr notification firing dateTime + 1 day
Calculate the 48hr and 72hr notification firing dateTime
- Create a Data Flow with a
dateTime
input, we’ll be passing NOW()
in when calling the Data Flow from your Web Flows. I’ll be calling this input dateTime
- Add a Calendar Search data operation
- Select the TCPA calendar
- Select the Restriction Run in next window
- Set the Time expression to
UPDATE_DAY(dateTime, dateTime.date.day + 2)
- Set the output name to
calendar48
- Add a Transform step
- set the Transform Expression to
MERGE_OBJECTS(calendar48.start, { "time": dateTime.time })
This will take the updated Firing Day from the Calendar Search, and update the Firing Time with the time of the initial SMS notification. (you can use calendar48.start
if you don’t mind the notification going out at 8am)
- Set the output variable name to
notification48
- Add a second Calendar Search data operation
- Select the TCPA calendar
- Select the Restriction Run in next window
- Set the Time expression to
UPDATE_DAY(notification48, notification48.date.day + 1)
- Set the output name to
calendar72
- Add another Transform step (this one we’ll use as the return value of the data flow)
- set the Transform Expression to
{
"reminder_48hr": notification48,
"reminder_72hr": MERGE_OBJECTS(calendar72.start, { "time": dateTime.time })
}
The output shoud look something like:{
"reminder_48hr": {
"date": {
"year": 2022,
"month": 6,
"day": 13
},
"time": {
"hour": 18,
"minute": 39,
"second": 24,
"millisecond": 872
},
"timeZone": "UTC"
},
"reminder_72hr": {
"date": {
"year": 2022,
"month": 6,
"day": 14
},
"time": {
"hour": 18,
"minute": 39,
"second": 24,
"millisecond": 872
},
"timeZone": "UTC"
}
}
- Set the Data Flow’s return value to the output of the last Transform (step 5)
Running the Data Flow and Setting up the Timers for the Reminder Notifications
-
Add a Run Data Flow to your initial Journey actions (right after the first SMS Notification is sent)
-
Run the Data Flow
- Set the dateTime input to
NOW()
- Set the Output Binding to a variable of your choice, name it something like
notifications
(Global or Web Flow depending on your use case)
-
Add a Timer to trigger and fire the 48hr notification message
- Set the Execution Time as the following Custom Expression:
notifcations.reminder_48hr
-
Add a Timer to trigger and fire the 48hr notification message
- Set the Execution Time as the following Custom Expression:
notifcations.reminder_72hr
-
Add the desired actions to each timer, and you should be good to go!