Notion AI Database Extractor & Sync Tool avatar

Notion AI Database Extractor & Sync Tool

Pricing

Pay per usage

Go to Apify Store
Notion AI Database Extractor & Sync Tool

Notion AI Database Extractor & Sync Tool

Extract, summarize, and sync your Notion databases automatically. Supports AI summaries (GPT-4o), incremental updates, and secure HMAC webhooks. Ideal for analytics, CRM sync, or automation workflows.

Pricing

Pay per usage

Rating

5.0

(1)

Developer

Țugui Dragoș

Țugui Dragoș

Maintained by Community

Actor stats

2

Bookmarked

2

Total users

2

Monthly active users

a month ago

Last modified

Share

Apify Actor Node.js TypeScript Notion API OpenAI API Zod License: Proprietary

Seamlessly sync, summarize, and monitor Notion data. Built for scale. Enriched by AI.


Features

  • Incremental Sync - Only process changed items
  • AI Summaries - GPT-4o powered summaries with automatic language detection
  • Webhooks - Real-time notifications with HMAC security
  • Enterprise Ready - Memory protection, type safety, auto-retry, and 100k+ item capacity

Quick Start

1. Get Notion Integration Token

  1. Go to https://www.notion.so/my-integrations
  2. Click "+ New integration"
  3. Copy the Internal Integration Token (starts with ntn_)

2. Connect to Database

  1. Open your Notion database
  2. Click "⋯" menu → "Add connections" → Add your integration
  3. Copy Database ID from URL:
    https://www.notion.so/{workspace}/{DATABASE_ID}?v=...

3. Configure Actor

{
"NOTION_TOKEN": "secret_your_token_here",
"DATABASE_ID": "your_database_id_here"
}

Configuration

Required

ParameterDescription
NOTION_TOKENNotion integration token
DATABASE_ID32-character database ID

Core Settings

ParameterDefaultDescription
PAGE_SIZE100Items per API request (1-100)
enableIncrementaltrueOnly fetch changed items
maxItemsUnlimitedStop after N items
dryRunfalseTest mode (no state/webhook)
strictModefalseFail on AI errors

AI Settings

ParameterDefaultDescription
enableAifalseEnable AI summaries
OPENAI_API_KEY-OpenAI API key
aiModelgpt-4o-miniModel: gpt-4o-mini or gpt-4o
aiMaxTokens256Max tokens (50-1000)
aiConcurrency5Max parallel AI requests (1-50)
summarizeFields["title", "properties"]Fields to summarize
aiPromptTemplateDefaultCustom prompt with {{CONTENT}}

Webhook Settings

ParameterDescription
webhookUrlHTTP endpoint for notifications
webhookSecretHMAC secret for verification

Usage Examples

Basic Extraction

{
"NOTION_TOKEN": "secret_abc123...",
"DATABASE_ID": "xyz789..."
}

With AI Summaries

{
"NOTION_TOKEN": "secret_abc123...",
"DATABASE_ID": "xyz789...",
"enableAi": true,
"OPENAI_API_KEY": "sk-...",
"aiModel": "gpt-4o-mini",
"summarizeFields": ["title", "properties"]
}

With Webhooks

{
"NOTION_TOKEN": "secret_abc123...",
"DATABASE_ID": "xyz789...",
"webhookUrl": "https://example.com/webhook",
"webhookSecret": "your-secret"
}

Output Format

{
"id": "page-id",
"title": "Project Alpha",
"url": "https://notion.so/...",
"lastEditedTime": "2024-11-07T15:30:45.000Z",
"createdTime": "2024-01-15T09:00:00.000Z",
"properties": {
"Status": "In Progress",
"Priority": "High",
"Tags": ["urgent"]
},
"summary": "AI-generated summary...",
"hash": "8f7a3b2c...",
"_meta": {
"databaseId": "xyz789...",
"runId": "abc123...",
"isNew": false,
"isUpdated": true,
"aiModel": "gpt-4o-mini"
}
}

Webhook Payload

{
"runId": "abc123",
"databaseId": "xyz789",
"timestamp": "2024-11-07T15:30:00.000Z",
"newItems": [
{
"id": "page-id",
"title": "New Task",
"url": "https://notion.so/..."
}
],
"updatedItems": [],
"newItemsCount": 42,
"updatedItemsCount": 0,
"totalProcessed": 42
}

Note: For performance stability, newItems and updatedItems arrays in the webhook are limited to the latest 1000 entries. Use newItemsCount / updatedItemsCount for total metrics, and access the Apify Dataset for the full list of items.

Verify Webhook Signature

const crypto = require('crypto');
function verifyWebhook(secret, timestamp, body, signature) {
const payload = `${timestamp}.${JSON.stringify(body)}`;
const expected = `sha256=${crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex')}`;
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}

Troubleshooting

No Data in Dataset

  • Verify integration permissions
  • Check database connection
  • Confirm correct DATABASE_ID

Rate Limit Errors

  • Actor auto-retries with backoff
  • Reduce PAGE_SIZE if persistent

AI Summaries Empty

  • Set enableAi: true
  • Verify valid OPENAI_API_KEY
  • Check OpenAI API credits

Incremental Not Working

  • Remove dryRun: true
  • Verify enableIncremental: true
  • Check for "State persisted" in logs

Webhook Not Received

  • Ensure URL is publicly accessible
  • Test with curl/Postman
  • Check endpoint accepts POST + JSON

Built with 🩶 for the Apify community 🫡