首页
看点啥
插画图片
首页 科技看点 Notion:自动化页面、数据库和区块 - Openclaw Skills

Notion:自动化页面、数据库和区块 - Openclaw Skills

2026-08-18 0

下载入口:https://github.com/openclaw/skills/tree/main/skills/steipete/notion

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install notion

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 notion。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

什么是 Notion API 集成?

Notion 技能为 AI 代理和开发人员提供了一个与 Notion 工作区交互的强大接口。通过将此技能集成到您的 Openclaw Skills 库中,您可以实现文档和数据库全生命周期的自动化。它专门针对最新的 2025-09-03 API 版本设计,确保与从传统数据库向数据源现代转型的兼容性。

该技能填补了原始数据与组织化知识管理之间的空白。它支持动态创建页面、使用特定过滤器查询复杂数据源,以及在区块级别精确修改页面内容。无论您是同步外部数据还是构建自定义 CMS,该技能都为您提供了无缝 Notion 自动化所需的技术基础。

Notion API 集成 应用场景

Notion API 集成 工作原理
  1. 该技能使用安全存储的内部集成令牌(Internal Integration Token)通过 Notion API 进行身份验证。
  2. 它针对已明确共享给该集成的特定页面或数据库进行操作。
  3. 利用 RESTful 接口,该技能将用户命令转换为 JSON 负载,用于创建或更新资源。
  4. 它根据最新 API 标准的要求,管理 database_id(用于页面创建)和 data_source_id(用于查询)之间的区别。
  5. 该技能处理来自 Notion 的响应以确认更新成功或检索请求的数据,并遵循每秒约 3 次请求的速率限制。

Notion API 集成 配置指南

要在您的 Openclaw Skills 设置中配置此技能,请按照以下步骤操作:

  1. notion.so/my-integrations 创建一个新的集成。
  2. 复制您的 API 密钥(以 ntn_secret_ 开头的秘密令牌)。
  3. 将密钥存储在本地配置目录中:
mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key
  1. 在 Notion 界面中,导航到您希望管理的页面或数据库,点击 “...” 菜单,选择 “连接到”,并选择您的集成名称。

Notion API 集成 数据架构与分类体系

该技能根据 Notion 对象模型组织数据,并针对 2025-09-03 版本更新进行了特别优化。

对象类型 关键标识符 用法
页面 page_id 用于检索内容或更新页面级属性。
数据源 data_source_id 查询和列出数据库内容的主要标识符。
数据库 database_id 将数据库设置为新页面的父级时需要。
区块 block_id 用于定位特定的内容元素进行更新或删除。

支持的属性类型包括标题、富文本、选择、多选、日期、复选框、数字、URL 和关联映射。

name: notion
description: Notion API for creating and managing pages, databases, and blocks.
homepage: https://developers.notion.com
metadata: {"clawdbot":{"emoji":"??"}}

notion

Use the Notion API to create/read/update pages, data sources (databases), and blocks.

Setup

  1. Create an integration at https://notion.so/my-integrations
  2. Copy the API key (starts with ntn_ or secret_)
  3. Store it:
mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key
  1. Share target pages/databases with your integration (click "..." → "Connect to" → your integration name)

API Basics

All requests need:

NOTION_KEY=$(cat ~/.config/notion/api_key)
curl -X GET "https://api.notion.com/v1/..." \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json"

Note: The Notion-Version header is required. This skill uses 2025-09-03 (latest). In this version, databases are called "data sources" in the API.

Common Operations

Search for pages and data sources:

curl -X POST "https://api.notion.com/v1/search" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json" \r
  -d '{"query": "page title"}'

Get page:

curl "https://api.notion.com/v1/pages/{page_id}" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03"

Get page content (blocks):

curl "https://api.notion.com/v1/blocks/{page_id}/children" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03"

Create page in a data source:

curl -X POST "https://api.notion.com/v1/pages" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json" \r
  -d '{
    "parent": {"database_id": "xxx"},
    "properties": {
      "Name": {"title": [{"text": {"content": "New Item"}}]},
      "Status": {"select": {"name": "Todo"}}
    }
  }'

Query a data source (database):

curl -X POST "https://api.notion.com/v1/data_sources/{data_source_id}/query" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json" \r
  -d '{
    "filter": {"property": "Status", "select": {"equals": "Active"}},
    "sorts": [{"property": "Date", "direction": "descending"}]
  }'

Create a data source (database):

curl -X POST "https://api.notion.com/v1/data_sources" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json" \r
  -d '{
    "parent": {"page_id": "xxx"},
    "title": [{"text": {"content": "My Database"}}],
    "properties": {
      "Name": {"title": {}},
      "Status": {"select": {"options": [{"name": "Todo"}, {"name": "Done"}]}},
      "Date": {"date": {}}
    }
  }'

Update page properties:

curl -X PATCH "https://api.notion.com/v1/pages/{page_id}" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json" \r
  -d '{"properties": {"Status": {"select": {"name": "Done"}}}}'

Add blocks to page:

curl -X PATCH "https://api.notion.com/v1/blocks/{page_id}/children" \r
  -H "Authorization: Bearer $NOTION_KEY" \r
  -H "Notion-Version: 2025-09-03" \r
  -H "Content-Type: application/json" \r
  -d '{
    "children": [
      {"object": "block", "type": "paragraph", "paragraph": {"rich_text": [{"text": {"content": "Hello"}}]}}
    ]
  }'

Property Types

Common property formats for database items:

Key Differences in 2025-09-03

Notes

喜欢(0)

上一篇

泰拉瑞亚npc居住分配组合-npc入住分配方案推荐

泰拉瑞亚npc居住分配组合-npc入住分配方案推荐

下一篇

百度搜索:AI 驱动的网页研究与数据检索 - Openclaw Skills

猜你喜欢