integrations

OpenClaw + Notion Integration Guide

Connect your OpenClaw agent to Notion to enable powerful data management, journaling, and analysis capabilities. This integration allows your agent to read from and write to Notion databases, making i

OpenClaw + Notion Integration Guide

Overview

Connect your OpenClaw agent to Notion to enable powerful data management, journaling, and analysis capabilities. This integration allows your agent to read from and write to Notion databases, making it perfect for task management, knowledge bases, and data analysis.

Benefits

  • Second Brain: Offload daily progress and reports to Notion for semantic search later
  • Data Analysis: Analyze large datasets stored in Notion databases (trade journals, project data, etc.)
  • Task Management: Automatically create and update tasks in Notion
  • Cost Effective: Notion is free and provides robust database capabilities
  • Organized Knowledge: Use Notion's multiple views (Kanban, Calendar, Table) to visualize data

Prerequisites

  • OpenClaw 3.2 or later installed and running
  • Notion account (free tier works)
  • Terminal access to your OpenClaw installation (SSH, Termius, or local terminal)
  • Basic understanding of environment variables

Step-by-Step Setup

Step 1: Create Notion Integration

  1. Navigate to notion.so/profile
  2. Click on "My integrations" in the left sidebar
  3. Click "+ New integration"
  4. Configure your integration:
    • Name: Choose a descriptive name (e.g., "OpenClaw Agent")
    • Associated workspace: Select your workspace
    • Icon: Optional - upload an icon if desired
  5. Click "Submit" or "Create"

Notion Integration Creation

Step 2: Get Your API Secret

  1. After creating the integration, you'll see the integration settings page
  2. Under "Internal Integration Secret", click "Show"
  3. Click "Copy" to copy your secret token
  4. ⚠️ IMPORTANT: Keep this secret secure - never share it publicly

Notion API Secret

Step 3: Store API Key Securely in .env File

This is the proper way to store API keys - never paste them directly in Discord, WhatsApp, or other chat channels.

  1. Open your terminal and connect to your OpenClaw server
  2. Navigate to your OpenClaw directory
  3. Run this command to edit your environment file:
nano ~/.openclaw/.env
  1. Add your Notion API key:
NOTION_API_KEY=your_internal_integration_secret_here
  1. Save and exit:
    • Press Ctrl + X
    • Press Y to confirm save
    • Press Enter to confirm filename

Environment Variable Setup

Example:

NOTION_API_KEY=secret_abc123XYZ456def789GHI012jkl345MNO678pqr901STU234vwx567YZA890

Step 4: Connect Integration to Notion Database

  1. Open or create a database in Notion (e.g., "Trade Journal", "Task Manager", "Knowledge Base")
  2. Click the "..." menu in the top-right corner of the database
  3. Select "Connections" (or "Add connections")
  4. Scroll down and find your integration name (e.g., "OpenClaw Agent")
  5. Click "Connect"

Connect Database

Step 5: Configure Permissions (Optional)

If you want your agent to only read data (not write or modify):

  1. Go back to your integration settings at notion.so/my-integrations
  2. Click on your integration
  3. Scroll down to "Capabilities"
  4. Disable:
    • "Update content"
    • "Insert content"
  5. Keep "Read content" enabled
  6. Click "Save changes"

For full read/write access (recommended for task management), keep all capabilities enabled.

Configuration Examples

Read-Only Configuration (Data Analysis)

Perfect for analyzing existing data without modification:

# .env file
NOTION_API_KEY=your_secret_key_here

Notion Integration Capabilities:

  • ✅ Read content
  • ❌ Update content
  • ❌ Insert content

Full Access Configuration (Task Management)

Allows agent to create, read, and update:

# .env file
NOTION_API_KEY=your_secret_key_here

Notion Integration Capabilities:

  • ✅ Read content
  • ✅ Update content
  • ✅ Insert content

Usage Examples

Example 1: Data Analysis (Read-Only)

You: Hey agent, can you review my entire trade history in the BingX Trade Journal database and tell me how many trades closed in an hour or less?

Agent: I found 548 total trades in your journal. 365 of them (66.6%) were closed in an hour or less. That's an interesting pattern - about 2/3 of your trades are short-term positions.

You: Can you focus only on BTC, ETH, and SOL trades?

Agent: Out of the 548 trades, 466 were BTC, ETH, or SOL. That means only 82 trades (15%) were other tokens. Your portfolio is heavily focused on major cryptocurrencies.

Example 2: Second Brain (Knowledge Management)

You: Upload today's research findings to my Knowledge Base in Notion

Agent: I've created a new entry in your Knowledge Base with today's date. The research on AI model optimization has been documented with key findings and references.

You: Can you search my past notes for anything related to "prompt engineering"?

Agent: I found 12 entries mentioning prompt engineering across your Knowledge Base. The most relevant ones are from March 2026 discussing few-shot learning techniques.

Example 3: Task Management

You: Create a task in Notion to review the Q2 financial reports by Friday

Agent: Task created in your Notion workspace:
- Title: Review Q2 Financial Reports
- Due Date: Friday, May 9, 2026
- Status: To Do
- Priority: High

Security Best Practices

✅ DO:

  • Store API keys in .env files - This is the proper, secure method
  • Use read-only permissions when you only need to analyze data
  • Revoke and regenerate tokens if they're accidentally exposed
  • Keep your .env file in .gitignore to prevent committing secrets to version control
  • Use separate integrations for different projects or agents

❌ DON'T:

  • Never paste API keys in Discord, Slack, WhatsApp, or other chat platforms
  • Never commit .env files to Git repositories
  • Never share screenshots containing API secrets
  • Don't use the same API key across multiple unrelated projects
  • Don't give full write permissions if read-only access is sufficient

Environment Variable Security

The .env file approach is secure because:

  1. AI models are trained not to reveal environment variables - Your agent won't accidentally leak secrets
  2. File permissions - The .env file is only accessible to your user account
  3. Separation of concerns - Secrets are separate from code and chat logs
  4. Easy rotation - Update the .env file to rotate keys without changing code

Common Issues and Solutions

Issue 1: Agent Can't Access Notion Database

Symptoms:

  • "I don't have access to that database"
  • "Permission denied" errors

Solution:

  1. Verify the database is connected to your integration (Step 4)
  2. Check that the integration has the correct capabilities enabled
  3. Ensure the API key in .env matches your integration secret

Issue 2: API Key Not Found

Symptoms:

  • "NOTION_API_KEY environment variable not set"
  • Agent asks for API key repeatedly

Solution:

  1. Verify the .env file exists: ls -la ~/.openclaw/.env
  2. Check the key is properly formatted: NOTION_API_KEY=secret_...
  3. Restart OpenClaw gateway: openclaw gateway restart

Issue 3: Integration Secret Exposed

Symptoms:

  • You accidentally shared your API key in a video, screenshot, or chat

Solution:

  1. Go to notion.so/my-integrations
  2. Click on your integration
  3. Under "Internal Integration Secret", click "Regenerate"
  4. Update your .env file with the new secret
  5. Restart OpenClaw gateway

Issue 4: Can't Edit .env File

Symptoms:

  • "Permission denied" when trying to edit .env
  • File doesn't exist

Solution:

# Create the directory if it doesn't exist
mkdir -p ~/.openclaw

# Create the .env file with proper permissions
touch ~/.openclaw/.env
chmod 600 ~/.openclaw/.env

# Now edit it
nano ~/.openclaw/.env

Advanced Use Cases

Multi-Database Setup

Connect multiple Notion databases for different purposes:

  1. Tasks Database - Project management and to-dos
  2. Knowledge Base - Research notes and documentation
  3. Data Analysis - Trade journals, metrics, analytics
  4. Meeting Notes - Automatic meeting summaries

Each database can have different permissions and structures.

Semantic Search

Use Notion as a long-term memory for your agent:

You: Search my past 6 months of notes for anything about "machine learning optimization"

Agent: I found 23 relevant entries. The most important insights were:
1. Batch size optimization (March 15, 2026)
2. Learning rate scheduling techniques (April 2, 2026)
3. Gradient accumulation strategies (April 28, 2026)

Automated Reporting

Set up your agent to automatically log daily progress:

You: At the end of each day, summarize what we worked on and log it to my Daily Journal in Notion

Agent: I'll create a daily summary entry in your Notion journal every evening with:
- Tasks completed
- Key decisions made
- Blockers encountered
- Next steps planned

Related Guides

Troubleshooting Checklist

Before asking for help, verify:

  • OpenClaw version is 3.2 or later (openclaw --version)
  • Notion integration is created and secret is copied
  • API key is stored in ~/.openclaw/.env with correct format
  • Database is connected to your integration in Notion
  • Integration has appropriate capabilities enabled
  • OpenClaw gateway has been restarted after configuration
  • No typos in environment variable name (NOTION_API_KEY)

Additional Resources


Video Tutorial: Watch the full setup guide

Need Help? Join the OpenClaw community Discord or check the troubleshooting guide.

Tags

integrations openclaw telegram discord notion
Back to Guides