Back to The Times of Claw

OpenClaw + Notion API: Sync Your Workspace

OpenClaw + Notion API integration lets your AI agent read and write Notion databases, sync pages to DuckDB, and automate cross-workspace workflows.

Mark Rachapoom
Mark Rachapoom
·9 min read
OpenClaw + Notion API: Sync Your Workspace

OpenClaw and Notion can work together through the Notion API — your DenchClaw agent can read databases, create pages, update records, and keep your Notion workspace in sync with your local CRM. This guide builds a Notion skill from scratch and shows you real workflows you can use immediately.

If you're new to DenchClaw, start with what DenchClaw is and the setup guide. This tutorial assumes DenchClaw is running at localhost:3100.

Why Connect OpenClaw to Notion#

Notion is a great writing surface. DenchClaw is a great thinking surface. They serve different purposes, and that's fine — the goal isn't to replace one with the other but to let your agent move information between them without you doing it manually.

Common use cases:

  • Sync a Notion project database to your DenchClaw CRM contacts
  • Read Notion meeting notes and extract action items into your task list
  • Create Notion pages from DenchClaw records (e.g., a new client onboarding doc)
  • Keep deal stages in sync between Notion and DuckDB
  • Query your Notion knowledge base from a DenchClaw chat

Step 1: Create a Notion Integration#

  1. Go to https://www.notion.so/my-integrations
  2. Click New integration
  3. Name it DenchClaw Agent
  4. Associate it with your workspace
  5. Set capabilities:
    • Read content: Yes
    • Update content: Yes (if you need writes)
    • Insert content: Yes (if you need to create pages)
  6. Submit and copy the Internal Integration Token — starts with secret_

Store it in your environment:

export NOTION_API_KEY="secret_your_token_here"

Connect your databases#

Notion integrations can only access pages and databases you explicitly share with them. For each database you want to use:

  1. Open the database in Notion
  2. Click the ... menu in the top right
  3. Go to Connections
  4. Add your DenchClaw Agent integration

Step 2: Find Your Database IDs#

Database IDs appear in the URL when you open a Notion database:

https://www.notion.so/YOUR_DATABASE_ID?v=...

The database ID is the 32-character hex string before the ?. You can also list all databases your integration can access:

curl -s -X POST https://api.notion.com/v1/search \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{"filter": {"value": "database", "property": "object"}}' \
  | jq '.results[] | {id, title: .title[0].plain_text}'

Save the IDs for the databases you'll use frequently.

Step 3: Create the Notion Skill#

mkdir -p ~/.openclaw-dench/workspace/skills/notion
cat > ~/.openclaw-dench/workspace/skills/notion/SKILL.md << 'EOF'
# Notion Skill
 
Use this skill for any task involving Notion: reading databases, creating pages,
updating records, syncing data, or querying the Notion workspace.
 
## Authentication
 
Use `$NOTION_API_KEY` from the environment. Always include these headers:

Authorization: Bearer $NOTION_API_KEY Notion-Version: 2022-06-28 Content-Type: application/json


## Common Database IDs

Store frequently used database IDs here after initial setup:
- Projects: [SET_AFTER_DISCOVERY]
- Contacts: [SET_AFTER_DISCOVERY]
- Tasks: [SET_AFTER_DISCOVERY]

## Key Operations

### Query a database
```bash
curl -s -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{"page_size": 100}'

Query with filter#

curl -s -X POST "https://api.notion.com/v1/databases/DATABASE_ID/query" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "property": "Status",
      "select": { "equals": "In Progress" }
    }
  }'

Create a page in a database#

curl -s -X POST "https://api.notion.com/v1/pages" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{
    "parent": {"database_id": "DATABASE_ID"},
    "properties": {
      "Name": {"title": [{"text": {"content": "New Page Title"}}]},
      "Status": {"select": {"name": "Not Started"}}
    }
  }'

Update a page property#

curl -s -X PATCH "https://api.notion.com/v1/pages/PAGE_ID" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{
    "properties": {
      "Status": {"select": {"name": "Done"}}
    }
  }'

Read page content (blocks)#

curl -s "https://api.notion.com/v1/blocks/PAGE_ID/children" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  | jq '.results[] | select(.type == "paragraph") | .paragraph.rich_text[0].plain_text'

Search across workspace#

curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_KEY" \
  -H "Notion-Version: 2022-06-28" \
  -H "Content-Type: application/json" \
  -d '{"query": "SEARCH_TERM"}'

Property Types#

Notion has many property types. Common ones:

  • title: {"title": [{"text": {"content": "value"}}]}
  • rich_text: {"rich_text": [{"text": {"content": "value"}}]}
  • select: {"select": {"name": "Option Name"}}
  • multi_select: {"multi_select": [{"name": "Tag1"}, {"name": "Tag2"}]}
  • number: {"number": 42}
  • checkbox: {"checkbox": true}
  • date: {"date": {"start": "2026-03-26"}}
  • url: {"url": "https://example.com"}
  • email: {"email": "user@example.com"}
  • relation: {"relation": [{"id": "page-id"}]}

Extracting Text from Pages#

Notion returns rich_text arrays. Extract plain text:

jq '.results[] | .properties.Name.title[0].plain_text'

Rate Limits#

Notion allows 3 requests/second per integration. For bulk operations, add sleep 0.34 between requests.

EOF


## Step 4: Sync a Notion Database to DuckDB

This is the most powerful workflow: pull your Notion data into DuckDB for rich querying and cross-referencing with your CRM.

### Create the DuckDB table

Ask your agent to create a schema for your Notion database, or do it manually:

```sql
-- Example for a Notion "Projects" database
CREATE TABLE IF NOT EXISTS notion_projects (
  notion_id VARCHAR PRIMARY KEY,
  name VARCHAR,
  status VARCHAR,
  owner VARCHAR,
  due_date DATE,
  url VARCHAR,
  last_edited TIMESTAMP,
  synced_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Sync command#

In DenchClaw chat:

Load the Notion skill. Query my Projects database (ID: your-db-id) and sync all 
records to the notion_projects table in DuckDB. Map: Name → name, Status → status, 
Owner → owner, Due Date → due_date. Report how many records were synced.

Your agent will:

  1. Query the Notion API
  2. Parse each property value
  3. Generate INSERT statements for DuckDB
  4. Execute the inserts
  5. Report the count

Scheduled sync#

To keep DuckDB in sync with Notion daily, add an entry to your HEARTBEAT.md:

## Daily Tasks
- Sync Notion Projects database to DuckDB (notion_projects table)
- Report any new projects added since last sync

Step 5: Create Notion Pages from DenchClaw Records#

Going the other direction — pushing DenchClaw data into Notion:

New client onboarding page#

When you add a new client to your CRM, automatically create a Notion onboarding document:

Load the Notion skill. For client Acme Corp (email: acme@example.com), 
create a new page in my Clients database with:
- Name: "Acme Corp — Onboarding"
- Status: "Active"  
- Start Date: today
Then add a content block with a standard onboarding checklist.

Meeting notes extraction#

After a meeting, paste the notes and ask your agent to extract and update Notion:

Here are my notes from today's Acme Corp call: [paste notes]

Load the Notion skill. Find the Acme Corp project page and update it with:
- Key decisions from the notes
- Action items as a checklist
- Next meeting date if mentioned

Step 6: Cross-Workspace Queries#

Once Notion data is in DuckDB, you can query across systems:

Which projects in Notion are past their due date AND don't have a contact 
associated in my CRM?

The agent queries both tables:

SELECT n.name, n.due_date, n.owner
FROM notion_projects n
LEFT JOIN crm_contacts c ON lower(n.owner) = lower(c.email)
WHERE n.due_date < CURRENT_DATE
AND n.status != 'Done'
AND c.id IS NULL
ORDER BY n.due_date ASC;

This kind of cross-system query would require a dedicated integration layer in traditional tools. In DenchClaw, it's a single SQL query against local data.

Practical Prompt Examples#

Here are prompts to try with your Notion skill configured:

What projects are currently "In Progress" in Notion?
Create a new task in my Notion Tasks database: 
"Review Q2 roadmap" due next Friday, assigned to me.
Read the content of the "Company Handbook" page in Notion 
and summarize the vacation policy section.
Sync my Notion Contacts database to DuckDB and show me any contacts 
who appear in Notion but not in my DenchClaw CRM.
For all completed projects in Notion this month, generate a brief 
summary report I can share with my team.

Troubleshooting#

"object not found" errors: Your integration isn't connected to that page or database. Open the page in Notion and add your integration under Connections.

Empty title arrays: Some properties return empty arrays if the field is blank. Always use jq with a null check: jq '.title[0].plain_text // "Untitled"'

Rate limit errors: You're hitting the 3 req/sec limit. Add sleep 0.34 between API calls in loops.

Properties not updating: Verify the property name matches exactly (case-sensitive) and that the property type matches the payload format.

FAQ#

Q: Can the agent read the content of Notion pages, not just properties? A: Yes. Use the blocks API endpoint (/blocks/PAGE_ID/children) to read page content. The skill template above shows how.

Q: Can I use this with Notion's public pages? A: No — the integration token only works with pages shared with your integration. Public pages aren't accessible via the API without the integration being connected.

Q: Does this work with Notion templates? A: Not directly. You'd need to create pages from scratch. However, you can create a "template" database record and duplicate its structure when creating new pages.

Q: How do I handle Notion's block-based content for writing? A: The Notion API accepts block arrays when creating pages. For common content types (paragraphs, headings, bullet lists, checkboxes), the skill includes the payload structure. Complex layouts need nested block arrays.

Q: Can I sync changes bidirectionally (DuckDB → Notion and Notion → DuckDB)? A: Yes, but you need to handle conflicts. The recommended approach: use last_edited_time from Notion as the source of truth for Notion-originated changes, and a denchclaw_updated_at field for DenchClaw-originated changes.

Ready to try DenchClaw? Install in one command: npx denchclaw. Full setup guide →

Mark Rachapoom

Written by

Mark Rachapoom

Building the future of AI CRM software.

Continue reading

DENCH

© 2026 DenchHQ · San Francisco, CA