Booking Links + Calendar Functions Reference
Complete scheduling reference with instructions, highlighted calendar rules, clickable code cards, full-copy support, and Google Calendar workflow notes.
SchedulingLink decides what can be booked. Booking records what was booked. Google Calendar confirms whether the time is truly available.
- Always check availability before showing a slot and again before creating a booking.
- Always store external_event_id on Booking so reschedule/cancel updates the same calendar event.
- Public pages should use getSchedulingLinkPublic, not direct entity reads.
Calendar-backed functions use the app-user Google Workspace Calendar connector when the user has connected their account.
const { accessToken } = await base44.asServiceRole.connectors.getCurrentAppUserConnection('69ddc2f7db4598a87eb698bd');
await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
headers: { Authorization: `Bearer ${accessToken}` }
});Booking Links are the scheduling layer for public guests, internal CRM scheduling, agent/referral partner portals, and Cielo appointment workflows. SchedulingLink controls the public/internal rules, Booking stores the appointment lifecycle, and Google Calendar functions keep the real external calendar in sync.
SchedulingLink
Controls slug, duration, timezone, calendar, business hours, buffers, meeting location, branding, questions, and default-link flags.
Booking
Stores each appointment, guest/contact data, manage token, Google event ID, meeting URL, status, and related loan/opportunity context.
Google Workspace Calendar Connector
Per-user Google Calendar connector used by availability and calendar sync functions. Current connector id: 69ddc2f7db4598a87eb698bd.
Confirmation + Reminder Layer
triggerAppointmentConfirmation, resendBookingConfirmation, and cieloAppointmentReminder send confirmations and reminder actions from Booking data.
=== PUBLIC BOOKING LINK FLOW === 1. Visitor opens the public booking route. 2. getSchedulingLinkPublic loads the public SchedulingLink by slug. 3. getAvailability calculates slots from SchedulingLink rules + Google Calendar conflicts. 4. Visitor selects a slot and submits guest details. 5. createBooking creates Booking, creates Google Calendar event, stores external_event_id, meeting_url, and manage_token. 6. Confirmation/reminder functions send follow-up messaging. 7. cancelBooking and rescheduleBooking use Booking.external_event_id to update the same calendar event. === INTERNAL + AGENT BOOKING FLOW === 1. Internal user, CRM, loan, opportunity, or portal starts scheduling. 2. getInternalAvailableSlots checks internal rules and real calendar conflicts. 3. createUnifiedBooking creates the Booking with source, loan_id, opportunity_id, and guest context. 4. syncAgentBookingToCalendar handles agent-originated calendar sync when needed. 5. Booking remains the source of truth for reminders, confirmations, and manage links. === GOOGLE CALENDAR FLOW === 1. User connects Google Workspace Calendar. 2. googleCalendarListCalendars lists available calendars for setup. 3. SchedulingLink.calendar_id stores the selected calendar. 4. Availability reads busy events before showing slots. 5. Booking creation/update/cancel writes back to Google Calendar.
SchedulingLink
Rules and public/internal link settings.
Booking
Appointment lifecycle, guest data, calendar event ID, manage token, and meeting URL.
EmailCalendarConnection
Legacy email/calendar connection metadata used by older flows.
SubAccount
Agent/referral/borrower portal identity used in portal scheduling.
Loan / Opportunity
Optional business context attached to internal bookings.
Public Booking Link Flow
Loads the safe public booking-link configuration by slug before the visitor sees times.
Click to view code + instructions →
Modes:
Features:
Calculates public available slots from SchedulingLink rules and real Google Calendar conflicts.
Click to view code + instructions →
Modes:
Features:
Creates the Booking record, writes the Google Calendar event, generates meeting/manage details, and sends confirmation.
Click to view code + instructions →
Modes:
Features:
Cancels a booking and updates/removes the linked Google Calendar event.
Click to view code + instructions →
Modes:
Features:
Moves an existing booking to a new validated slot and updates the same Google Calendar event.
Click to view code + instructions →
Modes:
Features:
Internal + Agent Scheduling
Finds internal slots for a target loan officer while checking real Google Calendar conflicts.
Click to view code + instructions →
Modes:
Features:
Central internal booking creator for CRM, loan, opportunity, and portal scheduling flows.
Click to view code + instructions →
Modes:
Features:
Syncs agent-originated appointment requests into the connected LO calendar.
Click to view code + instructions →
Modes:
Features:
Reads connected calendar events for portal schedule views.
Click to view code + instructions →
Modes:
Features:
Google Calendar Management
Lists calendars available to the connected Google account for scheduling setup.
Click to view code + instructions →
Modes:
Features:
Lists calendar events for diagnostics and schedule troubleshooting.
Click to view code + instructions →
Modes:
Features:
Updates an existing Google Calendar event during reschedule/update flows.
Click to view code + instructions →
Modes:
Features:
Deletes/cancels an existing Google Calendar event.
Click to view code + instructions →
Modes:
Features:
Diagnostics + Maintenance
Runs a focused health check for one SchedulingLink.
Click to view code + instructions →
Modes:
Features:
Inspects missing slugs, inactive links, calendar IDs, and ownership mismatches.
Click to view code + instructions →
Modes:
Features:
Repairs or creates missing default booking links for users.
Click to view code + instructions →
Modes:
Features:
Sends confirmation/reminder messaging for a Booking.
Click to view code + instructions →
Modes:
Features:
Finds upcoming bookings and sends Cielo reminder actions.
Click to view code + instructions →
Modes:
Features:
Important Notes
- Public links only show slots when SchedulingLink is active and visible.
- Google Calendar conflicts are checked before showing a slot and again before booking.
- Booking.external_event_id is required for clean cancellation and rescheduling.
- Agent/default scheduling links should be used first by Cielo when sending scheduling links.
67 files · 18,194 lines · full source inlined at build time. Copy any single file or the entire bundle in one shot.