作者:互联网 时间: 2026-08-11 17:35:01
从源直接安装技能的最快方式。
npx clawhub@latest install notion
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 notion。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Notion 技能为 AI 代理和开发人员提供了一个与 Notion 工作区交互的强大接口。通过将此技能集成到您的 Openclaw Skills 库中,您可以实现文档和数据库全生命周期的自动化。它专门针对最新的 2025-09-03 API 版本设计,确保与从传统数据库向数据源现代转型的兼容性。
该技能填补了原始数据与组织化知识管理之间的空白。它支持动态创建页面、使用特定过滤器查询复杂数据源,以及在区块级别精确修改页面内容。无论您是同步外部数据还是构建自定义 CMS,该技能都为您提供了无缝 Notion 自动化所需的技术基础。
要在您的 Openclaw Skills 设置中配置此技能,请按照以下步骤操作:
ntn_ 或 secret_ 开头的秘密令牌)。mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key
该技能根据 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":"??"}}
Use the Notion API to create/read/update pages, data sources (databases), and blocks.
ntn_ or secret_)mkdir -p ~/.config/notion
echo "ntn_your_key_here" > ~/.config/notion/api_key
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.
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"}}]}}
]
}'
Common property formats for database items:
{"title": [{"text": {"content": "..."}}]}{"rich_text": [{"text": {"content": "..."}}]}{"select": {"name": "Option"}}{"multi_select": [{"name": "A"}, {"name": "B"}]}{"date": {"start": "2024-01-15", "end": "2024-01-16"}}{"checkbox": true}{"number": 42}{"url": "https://..."}{"email": "[email protected]"}{"relation": [{"id": "page_id"}]}/data_sources/ endpoints for queries and retrievaldatabase_id and a data_source_id
database_id when creating pages (parent: {"database_id": "..."})data_source_id when querying (POST /v1/data_sources/{id}/query)"object": "data_source" with their data_source_idparent.data_source_id alongside parent.database_idGET /v1/data_sources/{data_source_id}is_inline: true when creating data sources to embed them in pages