rhiokim / notion-database-tracker

WIP: notion database tracker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

notion-database-tracker

Work in progress.

Deploy this example

Prerequisites

Deno Deploy

environment variable

NOTION_TOKEN=secret_g1hUavphAXyG1Ikff9xRDKvjRK7sImmv4SxyS6ScGiv
NOTION_DATABASE_ID=4d18218195a446c28a5866531f56ae13
POSTGRES_DATABASE_URL=postgres://postgres:XFE8GAC3_j4oB.2vN!AuKf8UW@db.pxiommvecxftwmhrhkzn.supabase.co:5432/postgres?sslmode=disable
DATABASE_TABLE=notion

How to use this

  • Create an integration in Notion
    • Fill name, logo, private input
    • Copy token secret_g1hUavphAXyG1Ikff9xRDKvjRK7sImmv4SxyS6ScGiv
    • Add notion integration account to notion database that you want to track
  • Deploy to Deno v3 with token and database id

How to work

  • Fetch Notion database
    • Store snapshot into localStorage with latest changes
  • Change state of your notion database menually
    • Call notion-database-tracker endpoint notion-database-tracker.deno.dev
  • Check diff snapshot with latest changes
    • Make response added/updated/deleted diff(snapshot, latestChanges)

How to run in local

git clone git@github.com:rhiokim/notion-database-tracker.git
cd notion-database-tracker

NOTION_TOKEN=<YOUR_NOTION_TOKEN> NOTION_DATABASE_ID=<NOTION_DATABASE_ID> \
deno run --allow-net \
--allow-env \
--location http://localhost \
mod.ts

References

About

WIP: notion database tracker

License:MIT License


Languages

Language:TypeScript 100.0%