In Part IV, we finalized the Scheduler Web Control so that it saves information associated with each selected appointment. Now, we'll schedule a TCPA-compliant Notification to remind users of their upcoming appointment an hour before it's scheduled.
- In Notifications Builder and create a new SMS Notification by clicking on the '+' icon to the right of the Notifications section in the Tree and selecting SMS Notification from the dropdown menu that appears. Rename this Notification “Appointment Reminder”.
Add an SMS message to the Appointment Reminder by clicking on the '+' icon to the right of "Appointment Reminder" in the Tree, and selecting Text from the dropdown menu that appears.
Click on the text now nested under the Appointment Reminder, then turn your attention to the Stage. Write a text message reminding the user of their upcoming appointment. To include their precise appointment time, add an Airscript expression by clicking on the Airscript icon to the upper right of the text box. Insert the following expression to display the selected appointment time in the user's own timezone:
FORMAT_DATETIME( session.appointment .start_time, "h:mm A z on MMMM Do, YYYY", "en-US", actor.time_zone )
- Toggle back to Web Flows Builder and return to the Scheduler Control in the Schedule Appointment Web Flow. Go to Actions tab in the Inspector and add a Start Timer Action. Complete it as follows:
- Change the key to “reminder-timer”
- Check Custom Expression and add this Airscript expression in order to schedule the timer for one hour before the selected appointment time:
SUBTRACT_FROM_DATETIME( session.appointment.start_time, 1, "hour" )
This expression uses the SUBTRACT_FROM_DATE Airscript function to return a DataTime one hour before the scheduled appointment.
- To remain TCPA compliant, under Which Availability Schedule > Custom Expression and add the following string:
This string is a Availability Schedule Key that references an out-of-the-box Availability Schedule, encompassing all times that TCPA allows messages to be sent given a particular region and timezone. To properly correspond to an Availability Schedule, the region and timezone need to be formatted correctly, which is why we designated
actor.time_zone in the format we did, back in Part II.
- In If time is not available select the Run in previous available window option.
- Nested underneath the Start Timer Action, add a Send SMS Action and select the Notification we just created, Appointment Reminder.
- Save the app
Let's go to App Preview to test the progress we have built so far.
After emulating appointment selection, click on the Timers tab to see the timers that are available at that stage of the Journey.
Select the timer you want to test and, from Actions, click on Activate Scheduled Trigger. By doing so, the timer will be triggered even though it is not yet the designated execution time.
- Go back to the Device tab and click on the chat icon at the bottom – you should see the Notification's message.
You've just created an SMS Notification and scheduled it to send shortly before the designated appointment while simultaneously enforcing TCPA regulations. Next, we'll create and schedule another TCPA-compliant Notification: one that follows up with users if and only if they neglect to schedule an appointment.
Updated 4 months ago