Skip to content

Google Maps Booking (integrations/google-maps-booking)

Server-side API client for Google Maps Booking (Google Business Profile), enabling merchant/service feed management, booking server callbacks, waitlist, and channel orders.

Overview

The Google Maps Booking workspace provides a TypeScript SDK for interacting with Google's Maps Booking API. It supports merchant/service feed management, availability slots, booking server callbacks (9 endpoints), waitlist operations, and channel orders. Authentication uses Google service account JWT signing via jose.

Tech Stack

LayerTechnologyVersion
RuntimeBun>= 1.3.0
LanguageTypeScript^6.0.3
ValidationZod^4.4.3
JWT Authjose^6.2.3
Bundlingbunup^0.16.32
TestingVitest^4.1.10
LintingBiome^2.5.4

API

  • Sandbox endpoint: https://partnerdev-mapsbooking.googleapis.com
  • Production endpoint: https://mapsbooking.googleapis.com
  • Auth endpoint: https://oauth2.googleapis.com/token
  • Scope: https://www.googleapis.com/auth/mapsbooking

Booking Server Endpoints

EndpointDescription
/v3/HealthCheckHealth check
/v3/BatchAvailabilityLookupCheck availability across merchants/services
/v3/CreateBookingCreate a booking
/v3/UpdateBookingUpdate booking status
/v3/JoinWaitlistJoin waitlist with party size
/v3/GetWaitlistInfoGet waitlist entry status
/v3/LeaveWaitlistLeave waitlist
/v3/CreateOrderCreate channel order with items
/v3/UpdateOrderUpdate channel order status

Channel Orders (New Feature)

Channel orders enable product/service orders from external channels via channel_orders and channel_order_items database tables (migration 0040-channel-orders.ts).

FunctionDescription
importChannelOrder(input)Insert order with items in transaction
fetchChannelOrderByExternalId(id)Fetch order by external ID
fetchChannelOrderById(id)Fetch order by internal ID
updateChannelOrderStatus(id, status)Update order status
findChannelOrderItemByInventoryId(orderId, itemId)Find item by inventory ID

Order status mapping: PENDINGpending, CONFIRMEDconfirmed, CANCELLEDcancelled, FULFILLEDfulfilled

External order ID format: gmo-{connection_id}-{service_id}-{timestamp}

Webhook Security

FeatureImplementation
SignatureHMAC-SHA256 with X-Booking-Webhook-Signature header (lowercase hex)
SecretGOOGLE_MAPS_BOOKING_WEBHOOK_SECRET env var (min 16 characters)
Replay preventionX-Booking-Webhook-Timestamp with 5-minute window
IdempotencyX-Booking-Webhook-Event-ID or SHA-256 body hash fallback
ComparisonConstant-time to prevent timing attacks

Configuration

VariableRequiredDescription
GOOGLE_MAPS_BOOKING_PARTNER_IDYesGoogle partner ID
GOOGLE_MAPS_BOOKING_CLIENT_EMAILYesService account email
GOOGLE_MAPS_BOOKING_PRIVATE_KEYYesService account private key
GOOGLE_MAPS_BOOKING_PROJECT_IDNoGoogle Cloud project ID
GOOGLE_MAPS_BOOKING_SYSTEM_USER_IDNoSystem user UUID (has fallback)
GOOGLE_MAPS_BOOKING_SANDBOXNoSandbox mode (default: false)
GOOGLE_MAPS_BOOKING_WEBHOOK_SECRETNoWebhook signing secret (min 16 chars)

Exports

ExportDescription
GoogleMapsBookingClientAPI client for Google Maps Booking
getAccessTokenOAuth2 service account token acquisition
BookingServerRouterRouter for Google Booking Server callbacks
createBookingServerRouterCreate a booking server router instance
createMerchant / createMerchantListMerchant feed builders
createService / createServiceListService feed builders
createAvailabilitySlot / createAvailabilityListAvailability feed builders

Key Scripts

bash
# Build
moon run integrations-google-maps-booking:build

# Quality
moon run integrations-google-maps-booking:lint
moon run integrations-google-maps-booking:typecheck
moon run integrations-google-maps-booking:verify

Architecture

integrations/google-maps-booking/
├── src/
│   ├── index.ts          # Package entry point
│   ├── auth.ts           # OAuth2 service account JWT auth
│   ├── client.ts         # Google Maps Booking API client
│   ├── booking-server.ts # Booking Server callback router
│   ├── feeds.ts          # Merchant, service, and availability feed builders
│   ├── types.ts          # TypeScript types and Zod schemas
│   └── client.test.ts    # Client unit tests
├── bunup.config.ts       # Bundler configuration
├── biome.jsonc           # Workspace-specific lint config
├── AGENTS.md
└── package.json

Platform Adapter

The platform adapter (apps/website/src/server/integrations/google-maps-booking/platform-adapter.ts) implements ExtendedBookingAdapter with:

  • healthCheck() — Returns { pong: true }
  • batchAvailabilityLookup() — Maps merchant/service to platform entities, checks capacity
  • createBooking() — Creates booking with idempotency key gmb-{merchant_id}-{service_id}-{start_sec}
  • updateBooking() — Maps Google status to platform status (CONFIRMED→confirmed, CANCELED→cancelled)
  • createOrder() — Creates channel order with user lookup and inventory item matching
  • updateOrder() — Updates channel order status
  • joinWaitlist() — Adds to waitlist with user creation/lookup
  • getWaitlistInfo() — Returns waitlist status (WAITING/SEATED/CANCELLED)
  • leaveWaitlist() — Removes from waitlist

Important

  • This package is server-side only. Never import into client-side components.
  • Uses jose for Google service account JWT signing.
  • All Google Maps Booking API callbacks (Booking Server) must be implemented by the consuming application.
  • Store GOOGLE_MAPS_BOOKING_PRIVATE_KEY via Infisical or environment variables.

Released under the MIT License.