# Automatically notify leads about earlier available booking times

URL: https://help.hubhus.com/kb/automatically-notify-leads-about-earlier-available-booking-times
Category: Calendar and booking / Booking forms
Updated: 2026-09-28T14:41:00.866+00:00

Summary: 3-component workflow: (1) Automation - triggers N days before event start, condition checks hh-booking.available-dates within next X days, action sends email if slots found. (2) Email template - notifies lead + includes rebooking link via @bookingFormUrlLead&#91;form-name&#93; . (3) Rebooking booking form - description checks availability again, shows appropriate message if slot already taken. Use available-dates (not optimal-datetime-slots ) for maximum rebooking opportunities.

Fill calendar gaps by automatically notifying leads when an earlier booking slot opens up before their scheduled appointment - they receive an email with a link to rebook if they want.

## Get started in 3 steps

1. **Set up the automation**. **Trigger:** Date/time trigger on Event start date, offset -14 days (adjust to your typical lead time). **Condition:** `@if(<hh-data.count><hh-booking.available-dates latest-date="+10days" booking-form="YOUR_FORM_ID" full-address="%lead_full_address%" /></hh-data.count> > 1){1}@else{0}@endif` - returns 1 if earlier slots exist within the next 10 days. **Action (if 1):** Send email notification. Replace `YOUR_FORM_ID` with the actual booking form ID.
2. **Create the notification email**. Write an email template that: (1) Explains earlier times are available, (2) Shows their current appointment time ( `%event_datetime%`), (3) Includes a rebooking button: `<a href="@bookingFormUrlLead[YOUR_REBOOK_FORM_NAME]">View earlier times</a>`, (4) Reassures them they don't need to act if they prefer to keep their current appointment.
3. **Configure the rebooking form**. In the booking form description, add conditional logic that re-checks availability when the lead opens the form: if no earlier slots exist anymore (slot was taken between sending email and clicking link), show a polite message. If slots still exist, show the normal booking calendar. Hide the address input (use the lead's existing address). Set `latest_date` to one day before their current appointment so they can't accidentally book later than they have now.

**Read more - full copy-paste templates**

### Step 1 - Automation condition (copy as-is, replace form ID)

```
@if(<hh-data.count><hh-booking.available-dates latest-date="+10days" booking-form="YOUR_BOOKING_FORM_ID" full-address="%lead_full_address%" /></hh-data.count> > 1){1}@else{0}@endif
```

Replace `YOUR_BOOKING_FORM_ID` with your booking form's ID (find in Campaign settings → Booking forms). Returns 1 if any slots are available within 10 days, 0 otherwise. Trigger automation action when result = 1.

### Step 2 - Email template (paste into email HTML editor)

Replace `YOUR_REBOOK_FORM_NAME` with your rebooking form's API name, and update the contact details:

```
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #333; }
.email-container { max-width: 600px; margin: 0 auto; background: white; }
.header { background: #ffffff; color: #333; padding: 40px 30px 25px; border-bottom: 1px solid #f0f0f0; }
.header h1 { font-size: 28px; margin: 0 0 12px 0; font-weight: 300; }
.content { padding: 35px 30px; }
.rebook-button { display: inline-block; background: %brand_color%; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-size: 14px; }
.info-box { background: #fafafa; border-radius: 6px; margin: 25px 0; padding: 20px 25px; }
.info-row { display: flex; padding: 6px 0; }
.info-label { font-weight: 400; width: 80px; font-size: 14px; }
.info-value { color: #666; font-size: 14px; }
.two-col { display: flex; gap: 4%; margin: 25px 0; }
.col { flex: 1; background: #fafafa; border-radius: 6px; padding: 18px; }
@media only screen and (max-width: 600px) { .two-col { flex-direction: column !important; } }
</style>

<div>
  <div>
    <h1>Good news about your booking!</h1>
    <p>Earlier times are available than your current appointment.</p>
  </div>
  <div>
    <p>Hi %lead_name%,</p>
    <p>We have available times in the coming days. Instead of waiting for your appointment on <strong>%event_datetime%</strong>, you can book an earlier time if you'd like.</p>
    <div>
      <a href="@bookingFormUrlLead[YOUR_REBOOK_FORM_NAME]">View Earlier Times</a>
    </div>
    <div>
      <h3>Your Information</h3>
      <div><span>Name:</span><span>%lead_name%</span></div>
      <div><span>Phone:</span><span>%lead_phone%</span></div>
      <div><span>Email:</span><span>%lead_email%</span></div>
    </div>
    <div>
      <div><h4>Current Appointment</h4><p>%event_datetime%</p></div>
      <div><h4>Location</h4><p>%event_location%</p></div>
    </div>
    <p>If you prefer to keep your current appointment, you don't need to do anything.</p>
    <p>Questions? Contact us at YOUR_PHONE or YOUR_EMAIL.</p>
  </div>
</div>
```

### Step 3 - Booking form description (paste into the form's Description field)

Replace `service-field-api-name` with your service field slug, and `YOUR_BOOKING_FORM_ID` with your form ID. Sets `latest_date` to one day before the lead's existing appointment so they can only book earlier:

```
<style>.full-address-input-div {display:none;}</style>

<div>
  @input[service-field-api-name; id="selectedProducts"]
  <input type="hidden" id="duration-input" name="duration" value="35">
</div>

<input name='latest_date' value='<hh-date.format input="%event_start_datetime_db% -1day" output="Y-m-d" />' type='hidden' />

@if(<hh-data.count><hh-booking.available-dates latest-date="+10days" booking-form="YOUR_BOOKING_FORM_ID" full-address="%lead_full_address%" /></hh-data.count> > 1){
  <p>Earlier times are available - select a new time below.</p>
}@else{
  <div>
    <p><strong>No earlier times currently available.</strong> Your appointment remains on <strong>%event_datetime%</strong>. We'll contact you if earlier times open up.</p>
  </div>
}@endif
```

## Related articles

- https://help.hubhus.com/kb/how-to-set-up-automations
- https://help.hubhus.com/kb/creating-and-managing-booking-forms
- https://help.hubhus.com/kb/configuring-booking-form-submission-actions
- https://help.hubhus.com/kb/hh-components-reference-guide
