Skip to main content

Cloudflare KV to Notion

A Cloudflare Worker that syncs Todoist task data from Cloudflare KV to a Notion database on a scheduled basis. It creates new Notion pages for tasks that do not yet exist, and updates existing pages with the latest data from KV.

How It Works

The worker runs on a cron schedule (3 AM and 3 PM Bangkok time daily). On each run, it reads all tasks stored in a Cloudflare KV namespace and syncs them into a Notion database -- creating pages for new tasks and updating pages for existing ones.

A manual sync can also be triggered via the /sync HTTP endpoint.

Endpoints

MethodPathDescription
GET/healthHealth check
POST/syncManually trigger a full sync

Notion Database Schema

The target Notion database should have the following properties:

PropertyTypeDescription
Task NameTitleTask title
Task DescriptionRich TextTask description
URLURLTodoist task URL
DateRich TextDue date
PrioritySelectP1, P2, P3, P4
Todoist IdRich TextTodoist task ID (used for matching)
StatusStatusTo Do, Done, Canceled
Duration AmountRich TextDuration value
Duration UnitRich TextDuration unit (minute, hour)
ProjectRelationRelated project

Tech Stack

ComponentTechnology
RuntimeCloudflare Workers
StorageCloudflare KV (read)
DestinationNotion API
LanguageTypeScript