OpenClawSkills
GitHub

Notion 页面

社区

在 Notion 数据库中创建一个新页面。

安装

Save as `notion.js`. Requires NOTION_API_KEY and DATABASE_ID env vars.

源代码

JavaScript
Tutorial.terminal

// notion.js
// Creates a simple page in a Notion database

module.exports = async function(context) {
    const title = context.args.join(' ');
    const apiKey = process.env.NOTION_API_KEY;
    const dbId = process.env.DATABASE_ID;
    
    if (!apiKey || !dbId) return { error: "Missing config" };
    
    const res = await fetch('https://api.notion.com/v1/pages', {
        method: 'POST',
        headers: {
            'Authorization': `Bearer ${apiKey}`,
            'Notion-Version': '2022-06-28',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            parent: { database_id: dbId },
            properties: {
                Name: {
                    title: [{ text: { content: title } }]
                }
            }
        })
    });
    
    return await res.json();
};

实时预览

● 实时演示
Agent 会话
正在启动会话...

如何使用

  • 确保已安装必要的依赖项(如果有)。
  • 将文件放入您的 OpenClaw skills 文件夹(例如 ~/.openclaw/skills/)。
  • 重启您的 Agent 或重新加载配置。
  • 使用文件名(不带扩展名)作为工具名称调用它,或者如果描述清晰,可以通过自然语言调用。