{
  "schemaVersion": "1.0",
  "item": {
    "slug": "notion-sync",
    "name": "Notion Sync",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/robansuini/notion-sync",
    "canonicalUrl": "https://clawhub.ai/robansuini/notion-sync",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/notion-sync",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=notion-sync",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/API-REFERENCE.md",
      "scripts/add-to-database.js",
      "scripts/batch-update.js",
      "scripts/delete-notion-page.js",
      "scripts/get-database-schema.js"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/notion-sync"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/notion-sync",
    "agentPageUrl": "https://openagent3.xyz/skills/notion-sync/agent",
    "manifestUrl": "https://openagent3.xyz/skills/notion-sync/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/notion-sync/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Notion Sync",
        "body": "Bi-directional sync between markdown files and Notion pages, plus database management utilities for research tracking and project management."
      },
      {
        "title": "Upgrading",
        "body": "From v2.0: Replace --token \"ntn_...\" with --token-file, --token-stdin, or NOTION_API_KEY env var. Bare --token is no longer accepted (credentials should never appear in process listings).\n\nFrom v1.x: See v2.0 changelog for migration details."
      },
      {
        "title": "Requirements",
        "body": "Node.js v18 or later\nA Notion integration token (starts with ntn_ or secret_)"
      },
      {
        "title": "Setup",
        "body": "Go to https://www.notion.so/my-integrations\n\n\nCreate a new integration (or use an existing one)\n\n\nCopy the \"Internal Integration Token\"\n\n\nPass the token using one of these methods (priority order used by scripts):\nOption A — Token file (recommended):\necho \"ntn_your_token\" > ~/.notion-token && chmod 600 ~/.notion-token\nnode scripts/search-notion.js \"query\" --token-file ~/.notion-token\n\nOption B — Stdin pipe:\necho \"$NOTION_API_KEY\" | node scripts/search-notion.js \"query\" --token-stdin\n\nOption C — Environment variable:\nexport NOTION_API_KEY=\"ntn_your_token\"\nnode scripts/search-notion.js \"query\"\n\nAuto default: If ~/.notion-token exists, scripts use it automatically even without --token-file.\n\n\nShare your Notion pages/databases with the integration:\n\nOpen the page/database in Notion\nClick \"Share\" → \"Invite\"\nSelect your integration"
      },
      {
        "title": "JSON Output Mode",
        "body": "All scripts support a global --json flag.\n\nSuppresses progress logs written to stderr\nKeeps stdout machine-readable for automation\nErrors are emitted as JSON: { \"error\": \"...\" }\n\nExample:\n\nnode scripts/query-database.js <db-id> --limit 5 --json"
      },
      {
        "title": "Path Safety Mode",
        "body": "Scripts that read/write local files are restricted to the current working directory by default.\n\nPrevents accidental reads/writes outside the intended workspace\nApplies to: md-to-notion.js, add-to-database.js, notion-to-md.js, watch-notion.js\nOverride intentionally with --allow-unsafe-paths\n\nExamples:\n\n# Default (safe): path must be inside current workspace\nnode scripts/md-to-notion.js docs/draft.md <parent-id> \"Draft\"\n\n# Intentional override (outside workspace)\nnode scripts/notion-to-md.js <page-id> ~/Downloads/export.md --allow-unsafe-paths"
      },
      {
        "title": "1. Search Pages and Databases",
        "body": "Search across your Notion workspace by title or content.\n\nnode scripts/search-notion.js \"<query>\" [--filter page|database] [--limit 10] [--json]\n\nExamples:\n\n# Search for newsletter-related pages\nnode scripts/search-notion.js \"newsletter\"\n\n# Find only databases\nnode scripts/search-notion.js \"research\" --filter database\n\n# Limit results\nnode scripts/search-notion.js \"AI\" --limit 5\n\nOutput:\n\n[\n  {\n    \"id\": \"page-id-here\",\n    \"object\": \"page\",\n    \"title\": \"Newsletter Draft\",\n    \"url\": \"https://notion.so/...\",\n    \"lastEdited\": \"2026-02-01T09:00:00.000Z\"\n  }\n]"
      },
      {
        "title": "2. Query Databases with Filters",
        "body": "Query database contents with advanced filters and sorting.\n\nnode scripts/query-database.js <database-id> [--filter <json>] [--sort <json>] [--limit 10] [--json]\n\nExamples:\n\n# Get all items\nnode scripts/query-database.js xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n# Filter by Status = \"Complete\"\nnode scripts/query-database.js <db-id> \\\n  --filter '{\"property\": \"Status\", \"select\": {\"equals\": \"Complete\"}}'\n\n# Filter by Tags containing \"AI\"\nnode scripts/query-database.js <db-id> \\\n  --filter '{\"property\": \"Tags\", \"multi_select\": {\"contains\": \"AI\"}}'\n\n# Sort by Date descending\nnode scripts/query-database.js <db-id> \\\n  --sort '[{\"property\": \"Date\", \"direction\": \"descending\"}]'\n\n# Combine filter + sort\nnode scripts/query-database.js <db-id> \\\n  --filter '{\"property\": \"Status\", \"select\": {\"equals\": \"Complete\"}}' \\\n  --sort '[{\"property\": \"Date\", \"direction\": \"descending\"}]'\n\nCommon filter patterns:\n\nSelect equals: {\"property\": \"Status\", \"select\": {\"equals\": \"Done\"}}\nMulti-select contains: {\"property\": \"Tags\", \"multi_select\": {\"contains\": \"AI\"}}\nDate after: {\"property\": \"Date\", \"date\": {\"after\": \"2024-01-01\"}}\nCheckbox is true: {\"property\": \"Published\", \"checkbox\": {\"equals\": true}}\nNumber greater than: {\"property\": \"Count\", \"number\": {\"greater_than\": 100}}"
      },
      {
        "title": "3. Update Page Properties",
        "body": "Update properties for database pages (status, tags, dates, etc.).\n\nnode scripts/update-page-properties.js <page-id> <property-name> <value> [--type <type>] [--json]\n\nSupported types: select, multi_select, checkbox, number, url, email, date, rich_text\n\nExamples:\n\n# Set status\nnode scripts/update-page-properties.js <page-id> Status \"Complete\" --type select\n\n# Add multiple tags\nnode scripts/update-page-properties.js <page-id> Tags \"AI,Leadership,Research\" --type multi_select\n\n# Set checkbox\nnode scripts/update-page-properties.js <page-id> Published true --type checkbox\n\n# Set date\nnode scripts/update-page-properties.js <page-id> \"Publish Date\" \"2024-02-01\" --type date\n\n# Set URL\nnode scripts/update-page-properties.js <page-id> \"Source URL\" \"https://example.com\" --type url\n\n# Set number\nnode scripts/update-page-properties.js <page-id> \"Word Count\" 1200 --type number"
      },
      {
        "title": "4. Batch Update",
        "body": "Batch update a single property across multiple pages in one command.\n\nMode 1 — Query + Update:\n\nnode scripts/batch-update.js <database-id> <property-name> <value> --filter '<json>' [--type select] [--dry-run] [--limit 100]\n\nExample:\n\nnode scripts/batch-update.js <db-id> Status Review \\\n  --filter '{\"property\":\"Status\",\"select\":{\"equals\":\"Draft\"}}' \\\n  --type select\n\nMode 2 — Page IDs from stdin:\n\necho \"page-id-1\\npage-id-2\\npage-id-3\" | \\\n  node scripts/batch-update.js --stdin <property-name> <value> [--type select] [--dry-run]\n\nFeatures:\n\n--dry-run: prints pages that would be updated (with current property value) without writing\n--limit <n>: max pages to process (default 100)\nPagination in query mode (has_more/next_cursor) up to limit\nRate-limit friendly updates (300ms between page updates)\nProgress and summary on stderr, JSON result array on stdout"
      },
      {
        "title": "5. Markdown → Notion Sync",
        "body": "Push markdown content to Notion with full formatting support.\n\nnode scripts/md-to-notion.js \\\n  \"<markdown-file-path>\" \\\n  \"<notion-parent-page-id>\" \\\n  \"<page-title>\" [--json] [--allow-unsafe-paths]\n\nExample:\n\nnode scripts/md-to-notion.js \\\n  \"projects/newsletter-draft.md\" \\\n  \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  \"Newsletter Draft - Feb 2026\"\n\nSupported formatting:\n\nHeadings (H1-H3)\nBold/italic text\nLinks\nBullet lists\nCode blocks with syntax highlighting\nHorizontal dividers\nParagraphs\n\nFeatures:\n\nBatched uploads (100 blocks per request)\nAutomatic rate limiting (350ms between batches)\nRich text is automatically chunked to Notion's 2000-character limit (including bold/italic/link spans)\nReturns Notion page URL and ID\n\nOutput:\n\nParsed 294 blocks from markdown\n✓ Created page: https://www.notion.so/[title-and-id]\n✓ Appended 100 blocks (100-200)\n✓ Appended 94 blocks (200-294)\n\n✅ Successfully created Notion page!"
      },
      {
        "title": "6. Notion → Markdown Sync",
        "body": "Pull Notion page content and convert to markdown.\n\nnode scripts/notion-to-md.js <page-id> [output-file] [--json] [--allow-unsafe-paths]\n\nExample:\n\nnode scripts/notion-to-md.js \\\n  \"abc123-example-page-id-456def\" \\\n  \"newsletter-updated.md\"\n\nFeatures:\n\nConverts Notion blocks to markdown\nPreserves formatting (headings, lists, code, quotes)\nOptional file output (writes to file or stdout)"
      },
      {
        "title": "7. Change Detection & Monitoring",
        "body": "Monitor Notion pages for edits and compare with local markdown files.\n\nnode scripts/watch-notion.js \"<page-id>\" \"<local-markdown-path>\" [--state-file <path>] [--json] [--allow-unsafe-paths]\n\nExample:\n\nnode scripts/watch-notion.js \\\n  \"abc123-example-page-id-456def\" \\\n  \"projects/newsletter-draft.md\"\n\nState tracking: By default maintains state in memory/notion-watch-state.json (relative to current working directory). You can override with --state-file <path> (supports ~ expansion):\n\nnode scripts/watch-notion.js \"<page-id>\" \"<local-path>\" --state-file ~/.cache/notion-watch-state.json\n\nDefault state schema:\n\n{\n  \"pages\": {\n    \"<page-id>\": {\n      \"lastEditedTime\": \"2026-01-30T08:57:00.000Z\",\n      \"lastChecked\": \"2026-01-31T19:41:54.000Z\",\n      \"title\": \"Your Page Title\"\n    }\n  }\n}\n\nOutput:\n\n{\n  \"pageId\": \"<page-id>\",\n  \"title\": \"Your Page Title\",\n  \"lastEditedTime\": \"2026-01-30T08:57:00.000Z\",\n  \"hasChanges\": false,\n  \"localPath\": \"/path/to/your-draft.md\",\n  \"actions\": [\"✓ No changes since last check\"]\n}\n\nAutomated monitoring: Schedule periodic checks using cron, CI pipelines, or any task scheduler:\n\n# Example: cron job every 2 hours during work hours\n0 9-21/2 * * * cd /path/to/workspace && node scripts/watch-notion.js \"<page-id>\" \"<local-path>\"\n\nThe script outputs JSON — pipe it to any notification system when hasChanges is true."
      },
      {
        "title": "8. Database Management",
        "body": "Add Markdown Content to Database\n\nAdd a markdown file as a new page in any Notion database.\n\nnode scripts/add-to-database.js <database-id> \"<page-title>\" <markdown-file-path> [--json] [--allow-unsafe-paths]\n\nExamples:\n\n# Add research output\nnode scripts/add-to-database.js \\\n  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \\\n  \"Research Report - Feb 2026\" \\\n  projects/research-insights.md\n\n# Add project notes\nnode scripts/add-to-database.js \\\n  <project-db-id> \\\n  \"Sprint Retrospective\" \\\n  docs/retro-2026-02.md\n\n# Add meeting notes\nnode scripts/add-to-database.js \\\n  <notes-db-id> \\\n  \"Weekly Team Sync\" \\\n  notes/sync-2026-02-06.md\n\nFeatures:\n\nCreates database page with title property\nConverts markdown to Notion blocks (headings, paragraphs, dividers)\nHandles large files with batched uploads\nReturns page URL for immediate access\n\nNote: Additional properties (Type, Tags, Status, etc.) must be set manually in Notion UI after creation.\n\nInspect Database Schema\n\nnode scripts/get-database-schema.js <database-id> [--json]\n\nExample output:\n\n{\n  \"object\": \"database\",\n  \"id\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n  \"title\": [{\"plain_text\": \"Ax Resources\"}],\n  \"properties\": {\n    \"Name\": {\"type\": \"title\"},\n    \"Type\": {\"type\": \"select\"},\n    \"Tags\": {\"type\": \"multi_select\"}\n  }\n}\n\nUse when:\n\nSetting up new database integrations\nDebugging property names/types\nUnderstanding database structure\n\nArchive Pages\n\nnode scripts/delete-notion-page.js <page-id> [--json]\n\nNote: This archives the page (sets archived: true), not permanent deletion."
      },
      {
        "title": "Collaborative Editing Workflow",
        "body": "Push local draft to Notion:\nnode scripts/md-to-notion.js draft.md <parent-id> \"Draft Title\"\n\n\n\nUser edits in Notion (anywhere, any device)\n\n\nMonitor for changes:\nnode scripts/watch-notion.js <page-id> <local-path>\n# Returns hasChanges: true when edited\n\n\n\nPull updates back:\nnode scripts/notion-to-md.js <page-id> draft-updated.md\n\n\n\nRepeat as needed (update same page, don't create v2/v3/etc.)"
      },
      {
        "title": "Research Output Tracking",
        "body": "Generate research locally (e.g., via sub-agent)\n\n\nSync to Notion database:\nnode scripts/add-research-to-db.js\n\n\n\nUser adds metadata in Notion UI (Type, Tags, Status properties)\n\n\nAccess from anywhere via Notion web/mobile"
      },
      {
        "title": "Page ID Extraction",
        "body": "From Notion URL: https://notion.so/Page-Title-abc123-example-page-id-456def\n\nExtract: abc123-example-page-id-456def (last part after title)\n\nOr use the 32-char format: abc123examplepageid456def (hyphens optional)"
      },
      {
        "title": "Limitations",
        "body": "Property updates: Database properties (Type, Tags, Status) must be added manually in Notion UI after page creation. API property updates can be temperamental with inline databases.\nBlock limits: Very large markdown files (>1000 blocks) may take several minutes to sync due to rate limiting.\nFormatting: Some complex markdown (tables, nested lists >3 levels) may not convert perfectly."
      },
      {
        "title": "Troubleshooting",
        "body": "\"Could not find page\" error:\n\nEnsure page/database is shared with your integration\nCheck page ID format (32 chars, alphanumeric + hyphens)\n\n\"Module not found\" error:\n\nScripts use built-in Node.js https module (no npm install needed)\nEnsure running from the skill's directory (where scripts/ lives)\n\nRate limiting:\n\nNotion API has rate limits (~3 requests/second)\nScripts handle this automatically with 350ms delays between batches"
      },
      {
        "title": "scripts/",
        "body": "Core Sync:\n\nmd-to-notion.js - Markdown → Notion sync with full formatting\nnotion-to-md.js - Notion → Markdown conversion\nwatch-notion.js - Change detection and monitoring\n\nSearch & Query:\n\nsearch-notion.js - Search pages and databases by query\nquery-database.js - Query databases with filters and sorting\nupdate-page-properties.js - Update database page properties\nbatch-update.js - Batch update one property across many pages (query or stdin IDs)\n\nDatabase Management:\n\nadd-to-database.js - Add markdown files as database pages\nget-database-schema.js - Inspect database structure\ndelete-notion-page.js - Archive pages\n\nUtilities:\n\nnotion-utils.js - Shared utilities (error handling, property formatting, API requests)\n\nAll scripts use only built-in Node.js modules (https, fs) - no external dependencies required."
      },
      {
        "title": "references/",
        "body": "database-patterns.md - Common database schemas and property patterns"
      }
    ],
    "body": "Notion Sync\n\nBi-directional sync between markdown files and Notion pages, plus database management utilities for research tracking and project management.\n\nUpgrading\n\nFrom v2.0: Replace --token \"ntn_...\" with --token-file, --token-stdin, or NOTION_API_KEY env var. Bare --token is no longer accepted (credentials should never appear in process listings).\n\nFrom v1.x: See v2.0 changelog for migration details.\n\nRequirements\nNode.js v18 or later\nA Notion integration token (starts with ntn_ or secret_)\nSetup\n\nGo to https://www.notion.so/my-integrations\n\nCreate a new integration (or use an existing one)\n\nCopy the \"Internal Integration Token\"\n\nPass the token using one of these methods (priority order used by scripts):\n\nOption A — Token file (recommended):\n\necho \"ntn_your_token\" > ~/.notion-token && chmod 600 ~/.notion-token\nnode scripts/search-notion.js \"query\" --token-file ~/.notion-token\n\n\nOption B — Stdin pipe:\n\necho \"$NOTION_API_KEY\" | node scripts/search-notion.js \"query\" --token-stdin\n\n\nOption C — Environment variable:\n\nexport NOTION_API_KEY=\"ntn_your_token\"\nnode scripts/search-notion.js \"query\"\n\n\nAuto default: If ~/.notion-token exists, scripts use it automatically even without --token-file.\n\nShare your Notion pages/databases with the integration:\n\nOpen the page/database in Notion\nClick \"Share\" → \"Invite\"\nSelect your integration\nJSON Output Mode\n\nAll scripts support a global --json flag.\n\nSuppresses progress logs written to stderr\nKeeps stdout machine-readable for automation\nErrors are emitted as JSON: { \"error\": \"...\" }\n\nExample:\n\nnode scripts/query-database.js <db-id> --limit 5 --json\n\nPath Safety Mode\n\nScripts that read/write local files are restricted to the current working directory by default.\n\nPrevents accidental reads/writes outside the intended workspace\nApplies to: md-to-notion.js, add-to-database.js, notion-to-md.js, watch-notion.js\nOverride intentionally with --allow-unsafe-paths\n\nExamples:\n\n# Default (safe): path must be inside current workspace\nnode scripts/md-to-notion.js docs/draft.md <parent-id> \"Draft\"\n\n# Intentional override (outside workspace)\nnode scripts/notion-to-md.js <page-id> ~/Downloads/export.md --allow-unsafe-paths\n\nCore Operations\n1. Search Pages and Databases\n\nSearch across your Notion workspace by title or content.\n\nnode scripts/search-notion.js \"<query>\" [--filter page|database] [--limit 10] [--json]\n\n\nExamples:\n\n# Search for newsletter-related pages\nnode scripts/search-notion.js \"newsletter\"\n\n# Find only databases\nnode scripts/search-notion.js \"research\" --filter database\n\n# Limit results\nnode scripts/search-notion.js \"AI\" --limit 5\n\n\nOutput:\n\n[\n  {\n    \"id\": \"page-id-here\",\n    \"object\": \"page\",\n    \"title\": \"Newsletter Draft\",\n    \"url\": \"https://notion.so/...\",\n    \"lastEdited\": \"2026-02-01T09:00:00.000Z\"\n  }\n]\n\n2. Query Databases with Filters\n\nQuery database contents with advanced filters and sorting.\n\nnode scripts/query-database.js <database-id> [--filter <json>] [--sort <json>] [--limit 10] [--json]\n\n\nExamples:\n\n# Get all items\nnode scripts/query-database.js xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n# Filter by Status = \"Complete\"\nnode scripts/query-database.js <db-id> \\\n  --filter '{\"property\": \"Status\", \"select\": {\"equals\": \"Complete\"}}'\n\n# Filter by Tags containing \"AI\"\nnode scripts/query-database.js <db-id> \\\n  --filter '{\"property\": \"Tags\", \"multi_select\": {\"contains\": \"AI\"}}'\n\n# Sort by Date descending\nnode scripts/query-database.js <db-id> \\\n  --sort '[{\"property\": \"Date\", \"direction\": \"descending\"}]'\n\n# Combine filter + sort\nnode scripts/query-database.js <db-id> \\\n  --filter '{\"property\": \"Status\", \"select\": {\"equals\": \"Complete\"}}' \\\n  --sort '[{\"property\": \"Date\", \"direction\": \"descending\"}]'\n\n\nCommon filter patterns:\n\nSelect equals: {\"property\": \"Status\", \"select\": {\"equals\": \"Done\"}}\nMulti-select contains: {\"property\": \"Tags\", \"multi_select\": {\"contains\": \"AI\"}}\nDate after: {\"property\": \"Date\", \"date\": {\"after\": \"2024-01-01\"}}\nCheckbox is true: {\"property\": \"Published\", \"checkbox\": {\"equals\": true}}\nNumber greater than: {\"property\": \"Count\", \"number\": {\"greater_than\": 100}}\n3. Update Page Properties\n\nUpdate properties for database pages (status, tags, dates, etc.).\n\nnode scripts/update-page-properties.js <page-id> <property-name> <value> [--type <type>] [--json]\n\n\nSupported types: select, multi_select, checkbox, number, url, email, date, rich_text\n\nExamples:\n\n# Set status\nnode scripts/update-page-properties.js <page-id> Status \"Complete\" --type select\n\n# Add multiple tags\nnode scripts/update-page-properties.js <page-id> Tags \"AI,Leadership,Research\" --type multi_select\n\n# Set checkbox\nnode scripts/update-page-properties.js <page-id> Published true --type checkbox\n\n# Set date\nnode scripts/update-page-properties.js <page-id> \"Publish Date\" \"2024-02-01\" --type date\n\n# Set URL\nnode scripts/update-page-properties.js <page-id> \"Source URL\" \"https://example.com\" --type url\n\n# Set number\nnode scripts/update-page-properties.js <page-id> \"Word Count\" 1200 --type number\n\n4. Batch Update\n\nBatch update a single property across multiple pages in one command.\n\nMode 1 — Query + Update:\n\nnode scripts/batch-update.js <database-id> <property-name> <value> --filter '<json>' [--type select] [--dry-run] [--limit 100]\n\n\nExample:\n\nnode scripts/batch-update.js <db-id> Status Review \\\n  --filter '{\"property\":\"Status\",\"select\":{\"equals\":\"Draft\"}}' \\\n  --type select\n\n\nMode 2 — Page IDs from stdin:\n\necho \"page-id-1\\npage-id-2\\npage-id-3\" | \\\n  node scripts/batch-update.js --stdin <property-name> <value> [--type select] [--dry-run]\n\n\nFeatures:\n\n--dry-run: prints pages that would be updated (with current property value) without writing\n--limit <n>: max pages to process (default 100)\nPagination in query mode (has_more/next_cursor) up to limit\nRate-limit friendly updates (300ms between page updates)\nProgress and summary on stderr, JSON result array on stdout\n5. Markdown → Notion Sync\n\nPush markdown content to Notion with full formatting support.\n\nnode scripts/md-to-notion.js \\\n  \"<markdown-file-path>\" \\\n  \"<notion-parent-page-id>\" \\\n  \"<page-title>\" [--json] [--allow-unsafe-paths]\n\n\nExample:\n\nnode scripts/md-to-notion.js \\\n  \"projects/newsletter-draft.md\" \\\n  \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n  \"Newsletter Draft - Feb 2026\"\n\n\nSupported formatting:\n\nHeadings (H1-H3)\nBold/italic text\nLinks\nBullet lists\nCode blocks with syntax highlighting\nHorizontal dividers\nParagraphs\n\nFeatures:\n\nBatched uploads (100 blocks per request)\nAutomatic rate limiting (350ms between batches)\nRich text is automatically chunked to Notion's 2000-character limit (including bold/italic/link spans)\nReturns Notion page URL and ID\n\nOutput:\n\nParsed 294 blocks from markdown\n✓ Created page: https://www.notion.so/[title-and-id]\n✓ Appended 100 blocks (100-200)\n✓ Appended 94 blocks (200-294)\n\n✅ Successfully created Notion page!\n\n6. Notion → Markdown Sync\n\nPull Notion page content and convert to markdown.\n\nnode scripts/notion-to-md.js <page-id> [output-file] [--json] [--allow-unsafe-paths]\n\n\nExample:\n\nnode scripts/notion-to-md.js \\\n  \"abc123-example-page-id-456def\" \\\n  \"newsletter-updated.md\"\n\n\nFeatures:\n\nConverts Notion blocks to markdown\nPreserves formatting (headings, lists, code, quotes)\nOptional file output (writes to file or stdout)\n7. Change Detection & Monitoring\n\nMonitor Notion pages for edits and compare with local markdown files.\n\nnode scripts/watch-notion.js \"<page-id>\" \"<local-markdown-path>\" [--state-file <path>] [--json] [--allow-unsafe-paths]\n\n\nExample:\n\nnode scripts/watch-notion.js \\\n  \"abc123-example-page-id-456def\" \\\n  \"projects/newsletter-draft.md\"\n\n\nState tracking: By default maintains state in memory/notion-watch-state.json (relative to current working directory). You can override with --state-file <path> (supports ~ expansion):\n\nnode scripts/watch-notion.js \"<page-id>\" \"<local-path>\" --state-file ~/.cache/notion-watch-state.json\n\n\nDefault state schema:\n\n{\n  \"pages\": {\n    \"<page-id>\": {\n      \"lastEditedTime\": \"2026-01-30T08:57:00.000Z\",\n      \"lastChecked\": \"2026-01-31T19:41:54.000Z\",\n      \"title\": \"Your Page Title\"\n    }\n  }\n}\n\n\nOutput:\n\n{\n  \"pageId\": \"<page-id>\",\n  \"title\": \"Your Page Title\",\n  \"lastEditedTime\": \"2026-01-30T08:57:00.000Z\",\n  \"hasChanges\": false,\n  \"localPath\": \"/path/to/your-draft.md\",\n  \"actions\": [\"✓ No changes since last check\"]\n}\n\n\nAutomated monitoring: Schedule periodic checks using cron, CI pipelines, or any task scheduler:\n\n# Example: cron job every 2 hours during work hours\n0 9-21/2 * * * cd /path/to/workspace && node scripts/watch-notion.js \"<page-id>\" \"<local-path>\"\n\n\nThe script outputs JSON — pipe it to any notification system when hasChanges is true.\n\n8. Database Management\nAdd Markdown Content to Database\n\nAdd a markdown file as a new page in any Notion database.\n\nnode scripts/add-to-database.js <database-id> \"<page-title>\" <markdown-file-path> [--json] [--allow-unsafe-paths]\n\n\nExamples:\n\n# Add research output\nnode scripts/add-to-database.js \\\n  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \\\n  \"Research Report - Feb 2026\" \\\n  projects/research-insights.md\n\n# Add project notes\nnode scripts/add-to-database.js \\\n  <project-db-id> \\\n  \"Sprint Retrospective\" \\\n  docs/retro-2026-02.md\n\n# Add meeting notes\nnode scripts/add-to-database.js \\\n  <notes-db-id> \\\n  \"Weekly Team Sync\" \\\n  notes/sync-2026-02-06.md\n\n\nFeatures:\n\nCreates database page with title property\nConverts markdown to Notion blocks (headings, paragraphs, dividers)\nHandles large files with batched uploads\nReturns page URL for immediate access\n\nNote: Additional properties (Type, Tags, Status, etc.) must be set manually in Notion UI after creation.\n\nInspect Database Schema\nnode scripts/get-database-schema.js <database-id> [--json]\n\n\nExample output:\n\n{\n  \"object\": \"database\",\n  \"id\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n  \"title\": [{\"plain_text\": \"Ax Resources\"}],\n  \"properties\": {\n    \"Name\": {\"type\": \"title\"},\n    \"Type\": {\"type\": \"select\"},\n    \"Tags\": {\"type\": \"multi_select\"}\n  }\n}\n\n\nUse when:\n\nSetting up new database integrations\nDebugging property names/types\nUnderstanding database structure\nArchive Pages\nnode scripts/delete-notion-page.js <page-id> [--json]\n\n\nNote: This archives the page (sets archived: true), not permanent deletion.\n\nCommon Workflows\nCollaborative Editing Workflow\n\nPush local draft to Notion:\n\nnode scripts/md-to-notion.js draft.md <parent-id> \"Draft Title\"\n\n\nUser edits in Notion (anywhere, any device)\n\nMonitor for changes:\n\nnode scripts/watch-notion.js <page-id> <local-path>\n# Returns hasChanges: true when edited\n\n\nPull updates back:\n\nnode scripts/notion-to-md.js <page-id> draft-updated.md\n\n\nRepeat as needed (update same page, don't create v2/v3/etc.)\n\nResearch Output Tracking\n\nGenerate research locally (e.g., via sub-agent)\n\nSync to Notion database:\n\nnode scripts/add-research-to-db.js\n\n\nUser adds metadata in Notion UI (Type, Tags, Status properties)\n\nAccess from anywhere via Notion web/mobile\n\nPage ID Extraction\n\nFrom Notion URL: https://notion.so/Page-Title-abc123-example-page-id-456def\n\nExtract: abc123-example-page-id-456def (last part after title)\n\nOr use the 32-char format: abc123examplepageid456def (hyphens optional)\n\nLimitations\nProperty updates: Database properties (Type, Tags, Status) must be added manually in Notion UI after page creation. API property updates can be temperamental with inline databases.\nBlock limits: Very large markdown files (>1000 blocks) may take several minutes to sync due to rate limiting.\nFormatting: Some complex markdown (tables, nested lists >3 levels) may not convert perfectly.\nTroubleshooting\n\n\"Could not find page\" error:\n\nEnsure page/database is shared with your integration\nCheck page ID format (32 chars, alphanumeric + hyphens)\n\n\"Module not found\" error:\n\nScripts use built-in Node.js https module (no npm install needed)\nEnsure running from the skill's directory (where scripts/ lives)\n\nRate limiting:\n\nNotion API has rate limits (~3 requests/second)\nScripts handle this automatically with 350ms delays between batches\nResources\nscripts/\n\nCore Sync:\n\nmd-to-notion.js - Markdown → Notion sync with full formatting\nnotion-to-md.js - Notion → Markdown conversion\nwatch-notion.js - Change detection and monitoring\n\nSearch & Query:\n\nsearch-notion.js - Search pages and databases by query\nquery-database.js - Query databases with filters and sorting\nupdate-page-properties.js - Update database page properties\nbatch-update.js - Batch update one property across many pages (query or stdin IDs)\n\nDatabase Management:\n\nadd-to-database.js - Add markdown files as database pages\nget-database-schema.js - Inspect database structure\ndelete-notion-page.js - Archive pages\n\nUtilities:\n\nnotion-utils.js - Shared utilities (error handling, property formatting, API requests)\n\nAll scripts use only built-in Node.js modules (https, fs) - no external dependencies required.\n\nreferences/\ndatabase-patterns.md - Common database schemas and property patterns"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/robansuini/notion-sync",
    "publisherUrl": "https://clawhub.ai/robansuini/notion-sync",
    "owner": "robansuini",
    "version": "2.5.3",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/notion-sync",
    "downloadUrl": "https://openagent3.xyz/downloads/notion-sync",
    "agentUrl": "https://openagent3.xyz/skills/notion-sync/agent",
    "manifestUrl": "https://openagent3.xyz/skills/notion-sync/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/notion-sync/agent.md"
  }
}