AgentSkillsCN

notion-fetch

搜索Notion工作区,以原始API格式将包含媒体文件的文档下载至本地文件夹。当用户要求搜索Notion、获取Notion文档、从Notion下载、获取Notion页面,或将Notion内容导出至本地时,可使用此功能。

SKILL.md
--- frontmatter
name: notion-fetch
description: Searches Notion workspaces and downloads documents with media files to local folders in raw API format. Use when asked to search Notion, fetch Notion documents, download from Notion, get Notion pages, or export Notion content locally.

Fetching Notion Documents

Requires NOTION_API_KEY environment variable.

Quick start

Search for documents:

bash
node scripts/notion-cli.js search "query"

Download a document with media:

bash
node scripts/notion-cli.js download <page-id> [output-dir]

Workflow

Copy this checklist when downloading documents:

code
Download Progress:
- [ ] Search for document
- [ ] Confirm correct document with user
- [ ] Download document and media
- [ ] Verify output files exist

Step 1: Search

bash
node scripts/notion-cli.js search "search terms"

Returns page IDs and titles.

Step 2: Confirm Show results to user and confirm which document to download.

Step 3: Download

bash
node scripts/notion-cli.js download <page-id> ./output-folder

Downloads JSON data and all media files.

Step 4: Verify Check output folder contains:

  • notion-data.json (raw API response)
  • notion-data-processed.json (local URLs)
  • media/ folder with images/videos

Output structure

code
output-folder/<page-id>/
├── notion-data.json           # Raw Notion API response
├── notion-data-processed.json # URLs rewritten to local paths
├── media-mapping.json         # Original URL → local path mapping
└── media/
    └── [downloaded images and videos]

Use notion-data-processed.json for further processing—URLs point to local ./media/ files.

Reference

For API response format and block types, see reference.md.