33. Google Calendar Integration | Form Forge - Build Forms with AI in Seconds
Download Log in

33. Google Calendar Integration

Developer Guide

Calendar picker field uses Google Calendar free/busy API for booking. PRO feature.

Server-side Calendar requests use the same site capability envelope as Google Sheets: license_key, product, forge_site_url, and site_token. Direct calls that only know the license key are rejected before the Worker touches Google tokens or creates events. Public submissions also validate calendar_picker values before payment capture: the posted value must parse to a future timestamp inside the field’s configured advance window, on an enabled weekday, and within work_start <= slot < work_end.

Calendar Picker Field

json
{
  "id": "field_appointment",
  "type": "calendar_picker",
  "label": "Preferred Time",
  "required": true,
  "slot_duration": 30,
  "work_start": 9,
  "work_end": 17,
  "advance_days": 30
}

Slot Calculation Flow

  1. User selects a date
  2. Frontend sends AJAX request to formforge_calendar_slots
  3. Server queries Google Calendar free/busy API
  4. Busy periods are subtracted from working hours to produce available slots
  5. Fallback: if Google API is unavailable, all slots within working hours are shown
php
$result = FORMFORGE_Forge_API::instance()->calendar_freebusy(
    $calendar_id,
    '2025-02-15T00:00:00Z',
    '2025-02-15T23:59:59Z',
    30, 9, 17
);
// Returns: { "available_slots": ["09:00", "09:30", "10:00", ...] }

Forge AI Assistant Online

Hi! I'm the Form Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs