1 Like
1 BranchVal Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Free, self-hosted Cal.com → Attio booking sync. When someone books, reschedules, cancels, or no-shows a meeting, this val:
- verifies the webhook signature (HMAC-SHA256, fails closed),
- finds or creates the Attio person by attendee email,
- writes the booking to a Bookings list parented to People — one entry per booking, keyed on the Cal.com booking UID, so lifecycle events update the same entry instead of duplicating it.
No database. Attio is the store. Terminal statuses (cancelled / completed / no_show) never regress to confirmed, so Cal.com's unordered webhook retries can't resurrect a dead booking.
Full setup guide, Attio schema script, tests, and a Cloudflare Workers variant live in the GitHub repo: miqcie/cal-attio-sync
Short version — remix this val, then:
- Get an Attio API key: app.attio.com → Workspace settings → Developers (needs record read-write and list read-write scopes).
- Run
scripts/setup-attio.tsfrom the repo to create the Bookings list in your Attio workspace. - Set two environment variables on your val (left sidebar):
ATTIO_API_KEYandCAL_WEBHOOK_SECRET(any random string). - In Cal.com, create a webhook at app.cal.com/settings/developer/webhooks pointing at this val's HTTP endpoint with that secret, and enable the
BOOKING_CREATED,BOOKING_RESCHEDULED,BOOKING_CANCELLED,BOOKING_NO_SHOW_UPDATED, andMEETING_ENDEDtriggers. (Scripting it instead? Grab an API key at app.cal.com/settings/developer/api-keys and use the repo'sscripts/setup-cal.ts.)
Book a test meeting; the booking appears in Attio within seconds, linked to the attendee's person record.
main.ts— HTTP entry (thin wrapper)src/core.ts— signature verification, payload normalization, event → status routingsrc/attio.ts— minimal Attio v2 client (query + PATCH/POST; deliberately not the assert endpoint, which matches on parent and would overwrite a repeat booker's earlier booking)
MIT licensed.