# Scheduling Appointment Reminder

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.

## Creating the appointment reminder Notification

1. 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”.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-716041a761cce80c1ed6cd4f13cf02eccb6a889e%2Fscheduling-a-pre-appointment-reminder-v183-0.png?alt=media)

2. 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.
3. 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:

```javascript
FORMAT_DATETIME(
  session.appointment
    .start_time,
  "h:mm A z on MMMM Do, YYYY",
  "en-US",
  actor.time_zone
)
```

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-7a322dc5f517913f726db8da8ebafd7d2c0158d5%2Fscheduling-a-pre-appointment-reminder-v183-1.png?alt=media)

## Scheduling the Notification

1. 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:

```javascript
SUBTRACT_FROM_DATETIME(
  session.appointment.start_time,
  1,
  "hour"
)
```

This expression uses the [SUBTRACT\_FROM\_DATE](../../airscript-expressions/datetime-functions/subtract_from_date) Airscript function to return a DataTime one hour before the scheduled appointment.

![](https://files.readme.io/c68359f-scheduler1.png)

* To remain TCPA compliant, under **Which Availability Schedule > Custom Expression** and add the following string:

```javascript
"TCPA-{{actor.region}}-{{actor.time_zone}}"
```

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.region` and `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.

<figure><img src="https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-b663421d2a184a13b63159e3cafad8f4258a9903%2Fscheduling-a-pre-appointment-reminder-v183-2.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

2. Nested underneath the **Start Timer** Action, add a **Send SMS** Action and select the Notification we just created, **Appointment Reminder**.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-3da8664092e082d2fc9b3cc17974e2a5790fccc0%2Fscheduling-a-pre-appointment-reminder-v183-3.png?alt=media)

3. Save the app

## Previewing the reminder timer

Let's go to **App Preview** to test the progress we have built so far.

1. After emulating appointment selection, click on the **Timers** tab to see the timers that are available at that stage of the Journey.
2. 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.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-b3aaca0b4159d83364b8e43a430fc7113466d0d9%2Fscheduling-a-pre-appointment-reminder-v183-4.png?alt=media)

3. 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.
