A serverless function that synchronizes calendar events from Tockify into a Webflow CMS collection. Designed to run as a scheduled Digital Ocean Function.
This function reads calendar event data from Tockify's ICS feeds and detailed event API, then creates, updates, or deletes the corresponding items in Webflow CMS collections. It uses timestamp-based delta sync to avoid unnecessary API calls — only calendars that have changed since the last run are processed.
Tockify ICS Feed
↓
Parse & Transform (ics-middleware.js)
↓
Compare with Webflow (index.js)
↓
Create / Update / Delete (webflow-middleware.js)
↓
Update last-modified timestamp
- Delta sync — skips calendars that haven't changed since the last run
- Full sync option — force re-sync all events by setting
PERFORM_FULL_SYNC = true - Future events only — filters out past events automatically
- 90-day window — only syncs events occurring within the next 90 days
- Rich event data — fetches descriptions and CTAs from Tockify's detail API beyond what's in the ICS feed
- Reference resolution — maps events to Webflow location and category collection items
- Node.js (ES module support required)
- A Tockify account with one or more calendars
- A Webflow site with CMS collections for calendars, events, locations, and categories
- A Webflow API token with CMS access
The function expects four Webflow CMS collections:
| Collection | Purpose |
|---|---|
| Calendars | One item per Tockify calendar, stores the ICS feed slug and last-modified timestamp |
| Events | The synced event items |
| Locations | Reference items for event venues |
| Categories | Reference items for event categories |
Each Calendar item must have a field containing the Tockify ICS feed slug (e.g. my-calendar from tockify.com/api/feeds/ics/my-calendar).
git clone https://github.com/<your-username>/tockify-sync-v2.git
cd tockify-sync-v2npm installCopy the example below into a .env file at the project root:
SITE_TOKEN=your_webflow_api_token
SITE_ID=your_webflow_site_id
CALENDAR_COLLECTION_ID=your_calendar_collection_id
EVENT_COLLECTION_ID=your_event_collection_id
CATEGORIES_COLLECTION_ID=your_categories_collection_id
LOCATION_COLLECTION_ID=your_location_collection_idFor a separate development environment, create a .env-dev file with your staging Webflow credentials.
Uncomment the main() call at the bottom of index.js, then:
node index.jsThis function is structured for Digital Ocean Functions.
- Ensure your
project.ymlincludes this function under themomentspackage. - Set the environment variables in the Digital Ocean console or via the
doctlCLI. - Deploy with:
doctl serverless deploy .- Schedule the function using a Digital Ocean trigger (cron) to run on your desired interval (e.g. every hour).
Two constants near the top of index.js control sync behavior:
| Constant | Default | Description |
|---|---|---|
PERFORM_FULL_SYNC |
false |
Set to true to force re-sync all events regardless of last-modified timestamps |
The ICS fetch window is hardcoded to 90 days in ics-middleware.js.
tockify-sync-v2/
├── index.js # Entry point — orchestrates the sync loop
├── ics-middleware.js # Fetches and parses Tockify ICS feeds
├── tockify-middleware.js # Fetches detailed event data from Tockify API
├── webflow-middleware.js # Reads and writes Webflow CMS collections
└── package.json
| Package | Purpose |
|---|---|
axios |
HTTP requests to Tockify and Webflow APIs |
ical |
Parse iCalendar (ICS) format |
slugify |
Generate URL-safe slugs for events and locations |
webflow-api |
Official Webflow API client |
dotenv |
Load environment variables from .env files |
MIT