How to schedule SMS reminders utilizing TCPA Window + existing reminder timing

Hello I have a use case where I am sending out SMS reminders 48hr and 72 hrs after the original message. With this use case if the original SMS message is send out on Wednesday or Thursday of the week the reminder SMS will fall on the weekend which will wait til the TCPA window opens on Monday at 8am. I am seeing both messages 48hr and 72hr messages sending at the same time on Monday morning. I am wondering if there is a way to maintain that 24hr delay in message. Basically looking to take TCPA Availability + 24hr for the second reminder message.

See Second SMS Reminder - profile variables set for execution time to be 48hr after initial message.

I’m wondering if there is some custom express which could be used for the IF time is not available. Right now it’s got “NEXT” as the custom expression. Is there any documentation for that field?

Screen Shot 2022-06-06 at 8.48.00 AM

Thanks

Hi @jeffchen !!

Can you share a bit more info about the use case?

Here’s what I’d like to understand before offering a possible solution:

  1. Would you need to fire those notifications as if the only existing days were weekdays?
    Meaning: If your 24hr notification was to fall on a Saturday, you’d like it to be sent on Monday of the following week? (same idea for the 72hr notification)
  2. Do the notifications observe a Time of Day (as well as the day of the week) or is 9am on a weekday ok?
  3. Does your TCPA calendar include Holidays?
  4. If yes, would you be treating holidays as (per my first question) weekend days – as in, do not send anything on weekends and holidays! ?

cheers!


I have done something like this in the past with Schedule reminders. You use the calendar and the skip or next (not sure I remember which but we can find it on the docs) to find the next open window and then send the text message in that window.

@juanchax
Thanks for looking into this issue.
Note: Reminder messages are sent 48hrs and 72 hrs after initial triggered message.

During the “TCPA Work Week” Monday thru Friday, SMS reminders could be run in my use case on initially triggered 8am thru 8pm Monday thru Wednesday where I could receive, the first reminder message (48hr) before the end of Friday window. The 72hr reminder message would land outside of TCPA working days on a Saturday then be triggered at the first available window of 8am Monday morning the next week.

However if initial message is triggered on Thursday, the reminder messages 48hr and 72hr will fall on the weekend Saturday and Sunday. Both the 48hr and 72hr reminder message shows up on Monday morning at 8am which I feel is weird.

Three issues:

  1. These messages no longer are 48hrs or 72hr after initial message eg I triggered the initial message at 503PM. I expect to see again around that time period 5pm in the future.
  2. Third reminder sends a message at 8am at the same time as the second reminder not 24 hours after the second message.
  3. I understand that due to TCPA, any messages will be sent at the first open window but two at the same time is really weird.

TCPA does include holidays and they would be treated like weekends.

Hopefully this makes sense.

Here’s an example.

  • Initial Message sent Thursday 430pm → SMS received by customer no response
  • 48hr later Saturday 430pm, Second Reminder triggered with cron job, TCPA Rules do not allow message to be sent until Monday morning at 8am → SMS not received Saturday at 430pm but following Monday morning at 8am
  • 72hr later Sunday 430pm, Third Reminder triggered with cron job, TCPA Rules do not allow message to be sent until Monday morning at 8am → SMS not received Sunday at 430pm but following Monday morning at 8am (expected to receive Tuesday 8am due to TCPA rules 24hr delay). I think this would be acceptable.

What might be cool to have is since initial trigger was 430pm that the reminders trigger again 430pm Monday and Tuesday afternoons.

@zacharyc I’m using the next window function but I wanted to see if we could Next + 24hrs or something like that.

Ok, I see a couple of items to consider and work with now that I have a better understanding of your use case

  • Initial SMS sent NOW(),
  1. What DAY is the next available window per TCPA settings? → Data Flow using Calendar Search
  2. If 1) is after the weekend or a holiday, prevent the 72hr notification from firing at the same time
  3. 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:

  1. Calculate the 48hr notification firing dateTime, using NOW() + 2 days
  2. Calculate the 72hr notification firing dateTime, using the 48hr notification firing dateTime + 1 day

Calculate the 48hr and 72hr notification firing dateTime

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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"
                      }
    }
    
  6. 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

  1. Add a Run Data Flow to your initial Journey actions (right after the first SMS Notification is sent)

  2. 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)
  3. Add a Timer to trigger and fire the 48hr notification message

    • Set the Execution Time as the following Custom Expression:
    notifcations.reminder_48hr
    

  4. Add a Timer to trigger and fire the 48hr notification message

    • Set the Execution Time as the following Custom Expression:
    notifcations.reminder_72hr
    

  5. Add the desired actions to each timer, and you should be good to go!

1 Like