Skip to main content
Internal reference — not the public API

This documents NearSync's internal action-dispatch surface, used by the apps themselves and by tenant automations. It is not the public API and carries no stability guarantee — actions may change or be removed without notice. For the supported, versioned public API see API Reference.

Booking Endpoints

Endpoints for the public booking engine. Availability checks and booking creation are public (no JWT required), making them suitable for embedding in external websites and booking link pages. Booking management requires authentication.

All endpoints use POST to the hyper-worker base URL with the type field specifying the action.

POST https://<project>.supabase.co/functions/v1/hyper-worker

get-availability

Public - No authentication required.

Check calendar free/busy times for one or more calendars within a date range. Returns busy blocks so the client can calculate available slots.

Request

{
"type": "get-availability",
"timeMin": "2026-03-21T00:00:00Z",
"timeMax": "2026-03-28T00:00:00Z",
"calendarIds": ["calendar-id@resource.calendar.google.com"]
}
FieldTypeRequiredDescription
timeMinstringYesStart of the time range (ISO 8601 / RFC 3339)
timeMaxstringYesEnd of the time range (ISO 8601 / RFC 3339)
calendarIdsstring[]YesArray of Google Calendar IDs to check

Process

Calls the Google Calendar FreeBusy API and returns the busy intervals for the requested calendars.

Response

{
"busy": [
{
"start": "2026-03-21T10:00:00Z",
"end": "2026-03-21T11:00:00Z"
},
{
"start": "2026-03-21T14:00:00Z",
"end": "2026-03-21T15:30:00Z"
}
]
}

The response contains the time blocks that are busy. To determine available slots, subtract the busy blocks from your desired time range on the client side.


booking

Public - No authentication required.

Create a confirmed booking with automatic Google Meet link generation, confirmation emails, and optional WhatsApp notification.

Rate limit: 10 requests per 60 seconds

Request

{
"type": "booking",
"name": "John Smith",
"email": "john@example.com",
"phone": "+1234567890",
"company": "Acme Corp",
"date": "March 25, 2026",
"time": "2:00 PM",
"isoTime": "2026-03-25T10:00:00Z",
"timezone": "America/New_York"
}
FieldTypeRequiredDescription
namestringYesBooker's full name
emailstringYesBooker's email address
phonestringNoPhone number in E.164 format. If provided, a WhatsApp confirmation is sent
companystringNoCompany name
datestringYesHuman-readable date string for display in notifications
timestringYesHuman-readable time string for display in notifications
isoTimestringYesMeeting start time in ISO 8601 format (used for calendar event creation)
timezonestringYesIANA timezone identifier (e.g., America/New_York, Asia/Dubai)

Process

  1. Creates a 30-minute Google Calendar event with an auto-generated Google Meet link
  2. Inserts a booking record with status confirmed
  3. Sends a confirmation email to the booker (includes Meet link and calendar ICS attachment)
  4. Sends an admin alert email
  5. If phone is provided, sends a WhatsApp template message with the booker's name and meeting time

Response

{
"success": true,
"meetingLink": "https://meet.google.com/abc-defg-hij"
}

manage-booking

Authenticated - Requires JWT.

Cancel or manage an existing booking. Cancellation removes the associated Google Calendar event.

Request

{
"type": "manage-booking",
"action": "cancel",
"bookingId": "<uuid>"
}
FieldTypeRequiredDescription
actionstringYesManagement action. Currently supports: cancel
bookingIdstringYesBooking ID to manage

Process

For the cancel action:

  1. Updates the booking status to cancelled
  2. Deletes the associated Google Calendar event

Response

{
"success": true
}

Typical Integration Flow

A booking page typically follows this sequence:

1. Page loads
-> Call get-availability for the selected date range
-> Display available time slots to the user

2. User selects a slot and fills in their details
-> Call booking with the selected time and contact info
-> Show confirmation with the Meet link

3. Admin cancels if needed
-> Call manage-booking with action: cancel

Example: Fetching Available Slots

// Fetch busy times for next 7 days
const response = await fetch(HYPER_WORKER_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'get-availability',
timeMin: '2026-03-21T00:00:00Z',
timeMax: '2026-03-28T00:00:00Z',
calendarIds: ['primary']
})
})

const { busy } = await response.json()

// busy = [{ start: "...", end: "..." }, ...]
// Subtract from your available hours to get open slots

No Authorization header is needed for get-availability or booking since both are public endpoints.