Notion Page
CommunityCreate a new page in a Notion database.
Installation
Save as `notion.js`. Requires NOTION_API_KEY and DATABASE_ID env vars.
Source Code
JavaScriptTutorial.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();
};
Live Preview
β Live DemoAgent Session
How to use
- Ensure you have the necessary dependencies installed (if any).
- Place the file in your OpenClaw skills folder (e.g., ~/.openclaw/skills/).
- Restart your agent or reload configuration.
- Invoke it using the filename (without extension) as the tool name, or through natural language if the description is clear.