We build custom applications 5x faster and cheaper 🚀
Book a Free Consultation
Stuck on an error? Book a 30-minute call with an engineer and get a direct fix + next steps. No pressure, no commitment.
You integrate Notion with OpenClaw by creating a Notion integration (or OAuth app) to obtain credentials, building a small external HTTP service to perform authenticated Notion API calls (this service handles OAuth token exchange, token storage, webhook validation/polling, and any long‑running or stateful work), and then installing/configuring an OpenClaw skill in ClawHub that invokes that external service. Keep secrets (API tokens, client secret) in ClawHub’s secret store or another secure vault, use explicit OAuth flows or integration tokens (not implicit assumptions), and design the agent-side skill to call your external API or receive webhooks rather than trying to host persistent state inside the agent runtime.
<b>//</b> Exchange authorization code for access token
curl -X POST https://api.notion.com/v1/oauth/token \
-H "Content-Type: application/json" \
-d '{"grant_type": "authorization_code", "code": "AUTH_CODE_HERE", "redirect_uri": "https://your.server/callback", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"}'
<b>//</b> Create a Notion page using an integration or OAuth access token
curl -X POST https://api.notion.com/v1/pages \
-H "Authorization: Bearer $NOTION_TOKEN" \
-H "Notion-Version: 2022-06-28" \
-H "Content-Type: application/json" \
-d '{
"parent": { "database_id": "DATABASE_ID" },
"properties": {
"Name": { "title": [{ "text": { "content": "Example from OpenClaw" } }] }
}
}'
import express from 'express';
import fetch from 'node-fetch';
const app = express();
app.use(express.json());
app.post('/notion/create-page', async (req, res) => {
<b>//</b> In production validate caller (API key, signature, etc.)
const notionToken = process.env.NOTION_TOKEN; <b>//</b> Injected securely via ClawHub or vault
const { databaseId, title } = req.body;
try {
const notionRes = await fetch('https://api.notion.com/v1/pages', {
method: 'POST',
headers: {
'Authorization': `Bearer ${notionToken}`,
'Notion-Version': '2022-06-28',
'Content-Type': 'application/json'
},
body: JSON.stringify({
parent: { database_id: databaseId },
properties: {
Name: { title: [{ text: { content: title } }] }
}
})
});
const data = await notionRes.json();
if (!notionRes.ok) {
return res.status(502).json({ error: 'Notion API error', detail: data });
}
res.json({ success: true, notionId: data.id });
} catch (err) {
console.error(err);
res.status(500).json({ error: 'server_error' });
}
});
app.listen(3000, () => console.log('listening on 3000'));
Speak one‑on‑one with a senior engineer about your no‑code app, migration goals, and budget. In just half an hour you’ll leave with clear, actionable next steps—no strings attached.
1
The webhook usually fails because Notion didn’t create/authorize a subscription for that page, the OpenClaw skill endpoint isn’t publicly reachable/validated, or signature/auth/env vars are mismatched. Check Notion access, the subscription, the public URL (ngrok/host), webhook secret, and OpenClaw runtime logs for incoming requests and skill permission errors.
const express = require('express')
const crypto = require('crypto')
const app = express()
app.use(express.json())
// verify HMAC signature sent by Notion (header name may vary)
app.post('/webhook', (req, res) => {
const sig = req.headers['x-signature'] || ''
const expected = crypto.createHmac('sha256', process.env.WEBHOOK_SECRET)
.update(JSON.stringify(req.body)).digest('hex')
if (!crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))) return res.status(401).end()
// // process event quickly and return 200
console.log('webhook received', req.body)
res.status(200).end()
})
app.listen(3000)
2
If your OpenClaw OAuth token refresh to a Notion workspace fails, the usual causes are expired/revoked refresh tokens, incorrect client credentials or redirect URI, or storing credentials in the ephemeral agent runtime so the refresh state is lost. Check Notion's API error body, your skill’s credential configuration in ClawHub, and agent logs first — they usually show the precise OAuth error.
// Node example: request refresh token to Notion token endpoint
await fetch('https://api.notion.com/v1/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'refresh_token',
refresh_token: process.env.NOTION_REFRESH_TOKEN,
client_id: process.env.NOTION_CLIENT_ID,
client_secret: process.env.NOTION_CLIENT_SECRET
})
});
// // log status and body to debug
3
Direct answer: Schema mapping errors happen when Notion property types, names, or nullability don’t match the OpenClaw model fields — fix by aligning property types, normalizing names/IDs, adding conversion logic, and inspecting the sync logs and API responses to find the exact mismatches.
Check these first:
4
Direct answer: 429s from Notion mean you’re hitting their rate limits — fix by respecting the Retry-After header, adding exponential backoff + jitter, reducing concurrency/batching, switching to incremental (delta) sync, and offloading bulk work to external workers or queues outside the OpenClaw agent runtime.
This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.
From startups to enterprises and everything in between, see for yourself our incredible impact.
Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.Â