notion-syncBi-directional sync and management for Notion pages and databases. Use when working with Notion workspaces for collaborative editing, research tracking, proj...
Install via ClawdBot CLI:
clawdbot install robansuini/notion-syncBi-directional sync between markdown files and Notion pages, plus database management utilities for research tracking and project management.
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).
From v1.x: See v2.0 changelog for migration details.
ntn_ or secret_)Option A ā Token file (recommended):
echo "ntn_your_token" > ~/.notion-token && chmod 600 ~/.notion-token
node scripts/search-notion.js "query" --token-file ~/.notion-token
Option B ā Stdin pipe:
echo "$NOTION_API_KEY" | node scripts/search-notion.js "query" --token-stdin
Option C ā Environment variable:
export NOTION_API_KEY="ntn_your_token"
node scripts/search-notion.js "query"
Auto default: If ~/.notion-token exists, scripts use it automatically even without --token-file.
All scripts support a global --json flag.
{ "error": "..." }Example:
node scripts/query-database.js <db-id> --limit 5 --json
Search across your Notion workspace by title or content.
node scripts/search-notion.js "<query>" [--filter page|database] [--limit 10] [--json]
Examples:
# Search for newsletter-related pages
node scripts/search-notion.js "newsletter"
# Find only databases
node scripts/search-notion.js "research" --filter database
# Limit results
node scripts/search-notion.js "AI" --limit 5
Output:
[
{
"id": "page-id-here",
"object": "page",
"title": "Newsletter Draft",
"url": "https://notion.so/...",
"lastEdited": "2026-02-01T09:00:00.000Z"
}
]
Query database contents with advanced filters and sorting.
node scripts/query-database.js <database-id> [--filter <json>] [--sort <json>] [--limit 10] [--json]
Examples:
# Get all items
node scripts/query-database.js xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Filter by Status = "Complete"
node scripts/query-database.js <db-id> \
--filter '{"property": "Status", "select": {"equals": "Complete"}}'
# Filter by Tags containing "AI"
node scripts/query-database.js <db-id> \
--filter '{"property": "Tags", "multi_select": {"contains": "AI"}}'
# Sort by Date descending
node scripts/query-database.js <db-id> \
--sort '[{"property": "Date", "direction": "descending"}]'
# Combine filter + sort
node scripts/query-database.js <db-id> \
--filter '{"property": "Status", "select": {"equals": "Complete"}}' \
--sort '[{"property": "Date", "direction": "descending"}]'
Common filter patterns:
{"property": "Status", "select": {"equals": "Done"}}{"property": "Tags", "multi_select": {"contains": "AI"}}{"property": "Date", "date": {"after": "2024-01-01"}}{"property": "Published", "checkbox": {"equals": true}}{"property": "Count", "number": {"greater_than": 100}}Update properties for database pages (status, tags, dates, etc.).
node scripts/update-page-properties.js <page-id> <property-name> <value> [--type <type>] [--json]
Supported types: select, multi_select, checkbox, number, url, email, date, rich_text
Examples:
# Set status
node scripts/update-page-properties.js <page-id> Status "Complete" --type select
# Add multiple tags
node scripts/update-page-properties.js <page-id> Tags "AI,Leadership,Research" --type multi_select
# Set checkbox
node scripts/update-page-properties.js <page-id> Published true --type checkbox
# Set date
node scripts/update-page-properties.js <page-id> "Publish Date" "2024-02-01" --type date
# Set URL
node scripts/update-page-properties.js <page-id> "Source URL" "https://example.com" --type url
# Set number
node scripts/update-page-properties.js <page-id> "Word Count" 1200 --type number
Batch update a single property across multiple pages in one command.
Mode 1 ā Query + Update:
node scripts/batch-update.js <database-id> <property-name> <value> --filter '<json>' [--type select] [--dry-run] [--limit 100]
Example:
node scripts/batch-update.js <db-id> Status Review \
--filter '{"property":"Status","select":{"equals":"Draft"}}' \
--type select
Mode 2 ā Page IDs from stdin:
echo "page-id-1\npage-id-2\npage-id-3" | \
node scripts/batch-update.js --stdin <property-name> <value> [--type select] [--dry-run]
Features:
--dry-run: prints pages that would be updated (with current property value) without writing--limit : max pages to process (default 100)has_more/next_cursor) up to limitPush markdown content to Notion with full formatting support.
node scripts/md-to-notion.js \
"<markdown-file-path>" \
"<notion-parent-page-id>" \
"<page-title>" [--json]
Example:
node scripts/md-to-notion.js \
"projects/newsletter-draft.md" \
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
"Newsletter Draft - Feb 2026"
Supported formatting:
Features:
Output:
Parsed 294 blocks from markdown
ā Created page: https://www.notion.so/[title-and-id]
ā Appended 100 blocks (100-200)
ā Appended 94 blocks (200-294)
ā
Successfully created Notion page!
Pull Notion page content and convert to markdown.
node scripts/notion-to-md.js <page-id> [output-file] [--json]
Example:
node scripts/notion-to-md.js \
"abc123-example-page-id-456def" \
"newsletter-updated.md"
Features:
Monitor Notion pages for edits and compare with local markdown files.
node scripts/watch-notion.js "<page-id>" "<local-markdown-path>" [--state-file <path>] [--json]
Example:
node scripts/watch-notion.js \
"abc123-example-page-id-456def" \
"projects/newsletter-draft.md"
State tracking: By default maintains state in memory/notion-watch-state.json (relative to current working directory). You can override with --state-file (supports ~ expansion):
node scripts/watch-notion.js "<page-id>" "<local-path>" --state-file ~/.cache/notion-watch-state.json
Default state schema:
{
"pages": {
"<page-id>": {
"lastEditedTime": "2026-01-30T08:57:00.000Z",
"lastChecked": "2026-01-31T19:41:54.000Z",
"title": "Your Page Title"
}
}
}
Output:
{
"pageId": "<page-id>",
"title": "Your Page Title",
"lastEditedTime": "2026-01-30T08:57:00.000Z",
"hasChanges": false,
"localPath": "/path/to/your-draft.md",
"actions": ["ā No changes since last check"]
}
Automated monitoring: Schedule periodic checks using cron, CI pipelines, or any task scheduler:
# Example: cron job every 2 hours during work hours
0 9-21/2 * * * cd /path/to/workspace && node scripts/watch-notion.js "<page-id>" "<local-path>"
The script outputs JSON ā pipe it to any notification system when hasChanges is true.
Add a markdown file as a new page in any Notion database.
node scripts/add-to-database.js <database-id> "<page-title>" <markdown-file-path> [--json]
Examples:
# Add research output
node scripts/add-to-database.js \
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
"Research Report - Feb 2026" \
projects/research-insights.md
# Add project notes
node scripts/add-to-database.js \
<project-db-id> \
"Sprint Retrospective" \
docs/retro-2026-02.md
# Add meeting notes
node scripts/add-to-database.js \
<notes-db-id> \
"Weekly Team Sync" \
notes/sync-2026-02-06.md
Features:
Note: Additional properties (Type, Tags, Status, etc.) must be set manually in Notion UI after creation.
node scripts/get-database-schema.js <database-id> [--json]
Example output:
{
"object": "database",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"title": [{"plain_text": "Ax Resources"}],
"properties": {
"Name": {"type": "title"},
"Type": {"type": "select"},
"Tags": {"type": "multi_select"}
}
}
Use when:
node scripts/delete-notion-page.js <page-id> [--json]
Note: This archives the page (sets archived: true), not permanent deletion.
node scripts/md-to-notion.js draft.md <parent-id> "Draft Title"
node scripts/watch-notion.js <page-id> <local-path>
# Returns hasChanges: true when edited
node scripts/notion-to-md.js <page-id> draft-updated.md
node scripts/add-research-to-db.js
From Notion URL: https://notion.so/Page-Title-abc123-example-page-id-456def
Extract: abc123-example-page-id-456def (last part after title)
Or use the 32-char format: abc123examplepageid456def (hyphens optional)
"Could not find page" error:
"Module not found" error:
Rate limiting:
Core Sync:
Search & Query:
Database Management:
Utilities:
All scripts use only built-in Node.js modules (https, fs) - no external dependencies required.
Generated Mar 1, 2026
Researchers can use this skill to maintain a centralized Notion database for literature reviews, tracking papers by tags like methodology or topic, and updating completion status as they analyze sources. The search and query capabilities help organize large collections of academic materials efficiently.
Content teams can manage editorial calendars in Notion, using batch updates to change article statuses from 'Draft' to 'Review' to 'Published'. The ability to filter by tags and dates helps prioritize content while maintaining consistent metadata across all pieces.
Project managers can query databases to monitor task completion, filter by assignee or priority, and update status properties across multiple tasks simultaneously. The JSON output mode enables integration with dashboard tools for real-time project reporting.
Sales teams can maintain lead databases in Notion, using filters to identify hot prospects based on engagement scores or timeline, and update contact statuses in batches as leads progress through the sales funnel. The search function helps quickly locate specific client records.
Individuals can sync markdown notes to Notion pages for cross-device access, search across personal knowledge bases for specific topics, and organize content using tags and properties. The bi-directional sync ensures notes remain current across all platforms.
Offer this skill as part of a subscription service that helps businesses integrate Notion with their existing tools. Revenue comes from monthly subscriptions for automated sync services, custom filter configurations, and batch update scheduling for enterprise clients.
Provide consulting services to organizations needing Notion database optimization, including setting up property schemas, creating custom query filters, and training teams on batch operations. Revenue is generated through project-based fees and ongoing maintenance contracts.
Marketing or development agencies can use this skill internally to manage client projects in Notion, then offer similar setup as a value-added service to clients. Revenue streams include both internal efficiency gains and client setup fees for customized Notion workflows.
š¬ Integration Tip
Store the Notion API token securely using the recommended token file method with proper permissions, and always test batch operations with --dry-run first to prevent unintended mass updates to production databases.
Work with Obsidian vaults (plain Markdown notes) and automate via obsidian-cli.
Create, search, and manage Bear notes via grizzly CLI.
Track water and sleep with JSON file storage
Notion API for creating and managing pages, databases, and blocks.
Smart ClawdBot documentation access with local search index, cached snippets, and on-demand fetch. Token-efficient and freshness-aware.
Work with Obsidian vaults as a knowledge base. Features: fuzzy/phonetic search across all notes, auto-folder detection for new notes, create/read/edit notes with frontmatter, manage tags and wikilinks. Use when: querying knowledge base, saving notes/documents, editing existing notes by user instructions.