Community程式設計與開發github.com

Notion

使用 Notion CLI/API 管理頁面、Markdown 內容、資料來源、檔案、評論、搜尋、Workers 和原始 API 呼叫。

Notion 是什麼?

這個 Notion 技能提供了一個完整的介面,讓 AI 代理或開發者能透過命令列與 Notion 的 API 互動。它基於 `ntn`(Notion 官方 CLI)建構,提供了從頁面建立、內容編輯、資料庫查詢到檔案上傳和 Workers 部署等所有常見操作的簡潔命令。技能涵蓋了 Markdown 優先的頁面輔助工具、資料來源的進階篩選與排序、以及完整的原始 API 存取能力,適合需要自動化 Notion 工作流程的場景。支援的平台包括任何可執行 Bash 或類似 shell 的環境(如 Linux、macOS、WSL),並且可以透過環境變數設定認證。此外,技能也提供了當 `ntn` 不可用時使用 curl 的備援方案,以及針對 API 版本差異的注意事項。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/notion

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Notion 是做什麼的?

偏好使用官方 ntn CLI。僅在 ntn 無法使用或原始請求更清晰時才使用 curl。

設定

npm install -g ntn
ntn --version
ntn login

腳本/無頭模式認證:

export NOTION_API_TOKEN=secret_or_ntn_token
export NOTION_API_VERSION=2026-03-11

ntn api 會自動設定 Authorization 和 Notion-Version。預設使用 CLI 登入,或在設定了 NOTION_API_TOKEN 時使用該 Token。

檢查

ntn doctor
ntn api ls
ntn api ls --json
ntn api v1/comments --help
ntn api v1/comments --spec -X POST
ntn api v1/comments --docs -X POST

頁面

Markdown 優先的輔助工具:

ntn pages get <page-id>
ntn pages get <page-id> --json
ntn pages create --parent page:<page-id> --content '# Title\n\nBody'
ntn pages create --parent data-source:<data-source-id> < page.md
ntn pages update <page-id> --content '# Updated'
ntn pages update <page-id> < page.md
ntn pages trash <page-id> --yes

注意事項:

  • pages get 會輸出 Markdown,並將頁面屬性作為 frontmatter。
  • 內容輸入方式:--content、stdin,或在 TTY 中開啟編輯器。
  • 父層參考:page:<id>、database:<id>、data-source:<id>。
  • 如需屬性/範本/完整 Pages API,請使用 ntn api v1/pages。

資料來源

ntn datasources resolve <database-id>
ntn datasources resolve <database-id> --json
ntn datasources query <data-source-id>
ntn datasources query <data-source-id> --limit 50 --json
ntn datasources query <data-source-id> --sort 'Date desc'
ntn datasources query <data-source-id> --filter '{"property":"Done","checkbox":{"equals":true}}'

當你有一個資料庫 ID 時,使用 resolve。查詢需要一個 data source ID。

原始 API

ntn api v1/users/me
ntn api v1/search query=roadmap page_size:=10
ntn api v1/pages 'parent[data_source_id]='"$DS_ID" 'properties[Name][title][0][text][content]=New item'
ntn api "v1/pages/$PAGE_ID" -X PATCH in_trash:=true
ntn api "v1/blocks/$PAGE_ID/children" -X PATCH \
  'children[0][type]=paragraph' \
  'children[0][paragraph][rich_text][0][text][content]=Hello'

輸入語法:

  • path=value:字串類型 body 欄位。
  • path:=json:JSON 類型 body 欄位(需為有效 JSON)。
  • name==value:查詢參數。
  • Header:Value:請求標頭。
  • --data '<json>' 或 stdin JSON:用於較大的 body。
  • 每個請求只能使用一個 body 來源。

檔案

ntn files create < image.png
ntn files create --filename photo.png --content-type image/png < /tmp/photo
ntn files create --external-url https://example.com/photo.png
ntn files get <upload-id>
ntn files list

Workers

ntn workers new
ntn workers deploy
ntn workers list --json
ntn workers runs list --json
ntn workers runs logs <run-id>

Workers 可能需要 Business/Enterprise 方案,並在工作空間中啟用。

Curl 備援方案

curl -sS "https://api.notion.com/v1/users/me" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2026-03-11" \
  -H "Content-Type: application/json"

版本注意事項

  • 目前的 API 最新版本:2026-03-11。
  • 使用 in_trash,而非 archived。
  • 區塊的附加定位使用 position,而非平坦的 after。
  • transcription 區塊已重新命名為 meeting_notes。
  • 資料庫可以包含多個資料來源;頁面父層通常使用 data_source_id。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相關技能