# Appointments & Booking

## Overview

Appointments lets customers book time slots from inside a WhatsApp chat. WaDesk reads your Google Calendar to see when you're free, offers the next open slots as a WhatsApp list message, and writes confirmed bookings back as calendar events — optionally with a Google Meet link. Find it under More → Appointments; it's admin-only.

Page | Purpose
--- | ---
Appointments | A connection-status panel plus lists of upcoming and recent past bookings, with cancel actions.
Settings | Connect Google Calendar, pick which calendar to book into, set availability windows, and tune booking rules.

The booking itself happens inside a flow: you add a Book appointment step to any flow, the customer picks a slot from a list message, and WaDesk books it end-to-end.

## Prerequisites

Requirement | Where it comes from / where to set it
--- | ---
Google Calendar set up platform-wide | An administrator registers a Google Cloud sign-in app at `console.cloud.google.com` and pastes the Client ID + Client Secret under Admin → Settings → Google Calendar (and enables it). Until then, the connect screen shows an "isn't configured yet" notice.
The redirect address | Defaults to `/appointments/oauth/google/callback` on your app's web address; the same admin page can override it. This address must be added to the Google Cloud app's list of authorized redirect URLs.
A connected Google account | You sign in to Google to grant calendar access on the settings page (per workspace).
Plan features | Booking requires the Appointment Booking and Google Calendar plan features. A monthly limit on the number of appointments also applies.
A flow with a Book appointment step | Customers book through a flow — see The booking flow.

> One sign-in unlocks every Google step. The same Google connection covers Calendar (Book appointment + Google Meet), Sheets, Docs, Drive (files the app created), and Forms steps, plus the inbox composer — so the first consent screen asks for the full set at once. You can manage the same account from the dedicated Google Account page. Admins who prefer a stricter setup can narrow what's requested in system settings.

## Connecting Google Calendar

Open Appointments → Settings and click Connect Google Calendar. You're sent to Google to approve access; on return, WaDesk stores the connection securely and brings you back.

1. WaDesk asks for the kind of access that keeps the connection alive in the background, so you don't have to sign in again and again.
2. On first connect, it uses your main calendar so Meet links and bookings work right away; you can pick a different calendar in Step 1 of the settings form.
3. The connection renews itself automatically, about 60 seconds before it would expire.
4. To disconnect, use Disconnect on the settings page — this removes the stored Google connection for the workspace.

> If renewal breaks. Keeping the connection alive depends on the admin's Google Cloud app being set up correctly. If it's misconfigured, the connection can quietly stop renewing. If bookings stop writing to the calendar, disconnect and reconnect to refresh it.

## Availability windows (Step 2)

Step 2 of the settings form defines when customers can book. There is one row per weekday with a from and to time. Leave a day blank to disable it entirely. A fresh workspace defaults to Mon–Fri, 09:00–18:00 with weekends off.

- Times use 24-hour HH:MM format, and the from time must be earlier than the to time; invalid or empty rows are dropped on save.
- Only calendars you can write to are listed in the picker.

> Tip: pick a dedicated calendar to book into so personal events don't mix with customer bookings.

## Booking rules (Step 3)

Step 3 controls how slots are generated. These rules feed directly into the slot calculation. All are required except the default location.

Rule | Range | Default | Effect
--- | --- | --- | ---
Slot duration (minutes) | 5–480 | 30 | Length of each bookable slot.
Max bookings per day | 1–96 | 16 | Caps how many slots are offered per day.
Buffer before (minutes) | 0–240 | 0 | Gap required before a slot; widens the clash check against calendar busy intervals.
Buffer after (minutes) | 0–240 | 0 | Gap required after a slot.
Advance booking window (days) | 1–90 | 14 | How far into the future slots are offered.
Reminder (minutes before) | 0–1440 | 60 | When to send the WhatsApp reminder. Set to 0 to disable reminders.
Default location (optional) | Max 191 | — | Location written onto each calendar event.

## The booking flow

Customers don't book from a page — they book through a flow. In the flow builder, add a Book appointment step to a flow. When it runs, the step:

1. Fetches the next available slots and sends them to the customer as a WhatsApp list message.
2. When the customer taps a slot, books it — creating the appointment and the calendar event.
3. Sends the confirmation back into the conversation.

The plan features and the monthly appointment limit are checked when the booking is made.

> No double-booking. If a customer taps the same slot twice in the same conversation, they get the existing appointment back rather than two bookings.

## Slot calculation

When slots are requested, WaDesk computes the next open times in the calendar's timezone:

1. Build candidate slots from your availability windows, from now through the end of your advance booking window.
2. Check your Google Calendar for the times you're already busy in that range.
3. Drop any slot that clashes with a busy time, widened by the before / after buffers.
4. Drop slots that are already in the past.
5. Apply the max-per-day cap.
6. Return the first few slots (a small handful at a time — up to 10, default 5).

Each slot is offered with a start time, an end time, and a friendly label like "Mon 3 Jun · 9:00 AM".

## Confirmations, Google Meet & reminders

When a slot is booked, WaDesk creates the appointment and, if a calendar is selected, writes the event to Google Calendar. Once the event is written, the appointment is marked confirmed (otherwise it stays pending).

Output | Detail
--- | ---
Calendar event | Carries the title, description, default location, the start/end times in the calendar's timezone, and Google's default reminders.
Attendee invite | If the customer's email is captured, they're added as an attendee and Google sends them its own invite email.
Google Meet link | A separate Google Meet flow step creates an event with a Meet video call attached, so the booking includes a video link. It uses the same Google connection. The inbox composer can also create a Meet link on demand.
WhatsApp reminder | Sent the set number of minutes before the slot (default 60; 0 disables it). Skipped when the booking is made inside the reminder window, or for a cancelled / declined appointment.

## Cancel & reschedule

From the Appointments list:

- Cancel an upcoming booking — marks it cancelled and deletes the linked Google Calendar event (if the event is already gone, that's treated as success).
- Reschedule — moves a booking to a new start/end time. WaDesk updates the same Google Calendar event, so attendees get a "this event was rescheduled" email rather than a brand-new invite, and the WhatsApp reminder is reset for the new time. The end must be after the start.

A booking that's already cancelled or declined can't be rescheduled. Appointments use these statuses:

Status | Meaning
--- | ---
Pending | Booked, but the calendar event hasn't been written yet.
Confirmed | Calendar event written; the booking is locked in.
Cancelled | Cancelled; the calendar event is removed.
Completed | The appointment has taken place.
No-show | The customer didn't attend.

## Timezone handling

Slots, events, and the bookings list all honour a timezone, resolved in this order: the connected calendar's timezone (captured when you pick the calendar), then the workspace timezone, and finally UTC. The list view shows each booking's start, end, and timezone explicitly so there's no ambiguity for operators working across regions.

## Troubleshooting

Symptom | Cause & fix
--- | ---
"Google Calendar isn't configured yet" | The platform admin hasn't set the Client ID / Secret. Add them under Admin → Settings → Google Calendar and enable it.
Redirect error from Google after sign-in | The redirect address isn't listed on the Google Cloud app. Add `/appointments/oauth/google/callback` (or the address shown in admin settings) to the app's authorized redirect URLs.
Bookings stop writing to the calendar | The Google connection likely stopped renewing. Disconnect and reconnect on the settings page to refresh it.
No calendars in the picker | WaDesk only lists calendars you can write to. Grant write access in Google Calendar, then click Refresh.
No slots offered to customers | Check the availability windows aren't all blank, that the advance window covers upcoming days, and that the calendar isn't fully busy (after buffers).
Customer's tap double-booked? | It can't — tapping the same slot twice returns the existing appointment.
Booking blocked when the customer tries to book | Your plan lacks Appointment Booking / Google Calendar, or the monthly appointment limit is reached. Upgrade or wait for the limit to reset.
No reminder was sent | The booking was made inside the reminder window, the reminder time is 0, or the appointment was cancelled/declined — all skip the reminder.
Meet link missing on a booking | The plain Book appointment step creates an event without Meet. Use the separate Google Meet step (or the inbox composer's Meet action) to attach a video link.