Skip to main content

Reverse Notion Sync

A Cloudflare Worker that syncs Todoist task data from Cloudflare KV back into Notion pages. Triggered by a Notion automation button, it fetches the latest task data from KV and patches the Notion page if any fields are out of date.

How It Works

Notion "Sync" Button click
--> Notion Automation (webhook)
--> POST /sync (this worker)
--> Fetch Notion page, extract Todoist Task ID
--> Fetch task from Cloudflare KV
--> Diff: Title, Status, Due Date, Priority
--> PATCH Notion page if anything is stale

Fields Synced

FieldSource of TruthAction
Task titleKVOverwrites Notion Name
CompletionKVUpdates Notion Status to Done/In Progress
Due dateKVOverwrites Notion Due Date
PriorityKVOverwrites Notion Priority select
Last SyncedWorkerAlways updated to current time

Notion Database Schema

PropertyTypeDescription
NameTitleTask title (compared with Todoist)
Todoist Task IDTextTodoist task ID for KV lookup
StatusStatusNot Started / In Progress / Done
Due DateDateCompared with Todoist due date
PrioritySelectP1 - Urgent, P2 - High, P3 - Medium, P4 - Normal
Last SyncedDateUpdated automatically on every sync
SyncButtonTrigger button for the automation

Tech Stack

ComponentTechnology
RuntimeCloudflare Workers
StorageCloudflare KV (read)
DestinationNotion API
LanguageTypeScript