# `valstorm-plugin-booking` — Hybrid Calendar Booking & Availability Engine Plugin (`FI-473`) Hybrid (**Python + Go**) public and authenticated calendar scheduling plugin for **Open Valstorm**, mounted at `platform.booking` (`VALSTORM_PLUGINS=booking` or `*`). Provides sub-second availability slot calculation (`GET /v1/booking/{slug}/availability`) and instant meeting reservation (`POST /v1/booking/{slug}/reserve`) with: - **Live Google Calendar FreeBusy Integration**: Automatically subtracts busy slots when `valstorm-plugin-google-workspace` is connected. - **Instant Google Meet Provisioning**: Generates a Google Meet link and one-click Google/Outlook calendar deep links on reservation. - **Automatic CRM Contact & Attribution Capture**: Upserts the `contact` record and captures full UTM / ad click-ID attribution (`gclid`, `fbclid`, `li_fat_id`, `utm_source`, `utm_medium`, `utm_campaign`). - **Custom Booking Links (`booking_link` / `bksl_`)**: Configure multiple booking slugs (`audit`, `demo`, `discovery`, `support`) with custom durations, business hours, and host timezones. --- ## 🤖 Agent-Assisted Quick Setup (Let the Valstorm Agent Set It Up) Your **Valstorm AI Agent** can create and configure your public booking slugs (`booking_link` `bksl_` records), connect your host Google Calendar for live FreeBusy conflict detection, and test slot availability and reservation end-to-end. ### 1. Copy-Paste Prompt for Your Valstorm Agent Drop this prompt into Valstorm Chat: > *"Set up `valstorm-plugin-booking` and create a booking link with slug `demo` ('30-Minute Product Demo', duration `30` minutes, host ``, email ``, timezone `America/New_York`). Verify availability via `booking_get_availability`."* ### 2. Agent Execution Runbook (Instructions for the AI Agent) 1. **Create or Update Booking Link (`booking_upsert_link`)**: - Call `await platform.booking.upsert_booking_link(slug=..., title=..., duration_minutes=..., host_name=..., host_email=..., host_timezone=...)`. 2. **Verify Availability & Calendar Integration (`booking_verify_connection`)**: - Call `booking_verify_connection` and `booking_get_availability(slug=...)` to confirm open business-day slots are returned in the visitor's timezone. --- ## 🛠️ End-to-End DIY Setup Guide (Manual) ### Step 1: Create a Booking Link (`booking_link` / `bksl_`) ```python link = await platform.booking.upsert_booking_link( slug="audit", title="15-Minute Architecture & Speed Review", description="Direct walkthrough of your infrastructure and migration plan.", duration_minutes=15, host_name="Jared Simpson", host_email="jared@valstorm.com", host_timezone="America/New_York", ) ``` ### Step 2: Embed or Call the Public Booking Endpoints - **Fetch Open Slots:** `GET /v1/booking/{slug}/availability?tz=America/New_York&days=7&duration=15` - **Reserve a Slot:** `POST /v1/booking/{slug}/reserve` ```json { "start_time": "2026-11-03T14:30:00Z", "end_time": "2026-11-03T14:45:00Z", "timezone": "America/New_York", "name": "Alex Mercer", "email": "alex@acme.io", "phone": "+18605551234", "notes": "Interested in Open Valstorm enterprise deployment", "attribution": { "utm_source": "linkedin", "utm_medium": "cpc", "utm_campaign": "q4_enterprise" } } ``` --- ## Running Tests (Python & Go) ```bash # Run Python unit & route tests cd apps/open-api .venv/bin/pytest tests/test_plugin_booking.py -v # Run Go sub-millisecond availability & reservation race tests cd ../../plugins/valstorm-plugin-booking/go go test -race -v ./... ```