Notion:自动化页面、数据库和区块 - Openclaw Skills
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install notion
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/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 数据源之间同步任务列表。
- 将日志、研究片段或自动化报告追加到特定的页面区块。
- 查询数据库以提取和处理结构化信息,供 AI 分析使用。
- 该技能使用安全存储的内部集成令牌(Internal Integration Token)通过 Notion API 进行身份验证。
- 它针对已明确共享给该集成的特定页面或数据库进行操作。
- 利用 RESTful 接口,该技能将用户命令转换为 JSON 负载,用于创建或更新资源。
- 它根据最新 API 标准的要求,管理 database_id(用于页面创建)和 data_source_id(用于查询)之间的区别。
- 该技能处理来自 Notion 的响应以确认更新成功或检索请求的数据,并遵循每秒约 3 次请求的速率限制。
Notion API 集成 配置指南
要在您的 Openclaw Skills 设置中配置此技能,请按照以下步骤操作:
- 在 notion.so/my-integrations 创建一个新的集成。
- 复制您的 API 密钥(以
ntn_或secret_开头的秘密令牌)。 - 将密钥存储在本地配置目录中:
mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key
- 在 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
- Create an integration at https://notion.so/my-integrations
- Copy the API key (starts with
ntn_orsecret_) - Store it:
mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key
- 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-Versionheader is required. This skill uses2025-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:
- Title:
{"title": [{"text": {"content": "..."}}]} - Rich text:
{"rich_text": [{"text": {"content": "..."}}]} - Select:
{"select": {"name": "Option"}} - Multi-select:
{"multi_select": [{"name": "A"}, {"name": "B"}]} - Date:
{"date": {"start": "2024-01-15", "end": "2024-01-16"}} - Checkbox:
{"checkbox": true} - Number:
{"number": 42} - URL:
{"url": "https://..."} - Email:
{"email": "[email protected]"} - Relation:
{"relation": [{"id": "page_id"}]}
Key Differences in 2025-09-03
- Databases → Data Sources: Use
/data_sources/endpoints for queries and retrieval - Two IDs: Each database now has both a
database_idand adata_source_id- Use
database_idwhen creating pages (parent: {"database_id": "..."}) - Use
data_source_idwhen querying (POST /v1/data_sources/{id}/query)
- Use
- Search results: Databases return as
"object": "data_source"with theirdata_source_id - Parent in responses: Pages show
parent.data_source_idalongsideparent.database_id - Finding the data_source_id: Search for the database, or call
GET /v1/data_sources/{data_source_id}
Notes
- Page/database IDs are UUIDs (with or without dashes)
- The API cannot set database view filters — that's UI-only
- Rate limit: ~3 requests/second average
- Use
is_inline: truewhen creating data sources to embed them in pages
-
08.11
《战双帕弥什》黄油小狗联动说明
-
08.11
希望城服装店解锁做法
-
08.11
《崩坏:星穹铁道》欢愉主光锥攻略
-
08.11
风启之旅新手武器与防具选择推荐指南
-
08.11
三国杀武将觉醒周瑜使用强度详细说明
-
08.11
生存33天篮球练习生技能效果说明
-
-
-
-
- 热血江湖哪个职业适合平a
- 08.11
-
-
- 绯月絮语有哪些兑换码
- 08.11
-
-
下载
- |
-
-
下载
- 《行尸走肉第一章》免安装中文汉化硬盘版下载
- 单机|436 MB
- 一款以动作冒险为主题的游戏
-
-
下载
- 《街头霸王X铁拳》免安装中文汉化硬盘版下载
- 单机|111MB
- 一款非常好玩的格斗游戏
-
-
下载
- |
-
-
下载
- 《暗黑破坏神3》免安装繁体中文正式版下载
- 单机|7630 MB
- 一款以角色扮演为主题的游戏
-
-
下载
- 《马克思佩恩3》免安装硬盘版下载
- 单机|27033 MB
- 一款以第三人称射击为主题的游戏