This project contains a script to sync data from Squarespace to CiviCRM.
-
Install dependencies:
npm install -
Create a
.envfile in the root of the project and add the following environment variables:SQUARESPACE_API_KEY=CIVICRM_API_KEY=CIVICRM_API_URL= -
Build the project:
npm run build -
Run a one-off sync:
npm startNote: The sync script supports graceful shutdown. Pressing
Ctrl+Cwill finish the current customer, clean up the.sync.lockfile, and exit safely. -
Run as a background server (Webhooks & Polling):
npm run serveThis starts an Express server on port 3000 (or
$PORT) that provides a/webhookendpoint to trigger syncs in real-time. It also automatically runs a sync every 10 minutes (configurable viaSYNC_INTERVALin seconds).If the
SERVICE_URL_SYNCenvironment variable is provided (e.g. by Coolify), the server will automatically register its/webhookendpoint with the Squarespace Webhook Subscriptions API on startup.