⚒️ Provide real-time updates for Notion databases via webhooks with Supabase

1,694 views · ⚒️ Engineering

Description

Purpose

This enables webhooks for nearly realtime updates (every 5 seconds) from Notion Databases.

Problem

Notion does not offer webhooks. Even worse, the “Last edited time” property, we could use for polling, only updates every minute. This gives us a polling interval only as low as 2 minutes and we still need to implement a comparing mechanism to detect changes.

Solution

This workflow caches states in between while doing efficient polling & comparing. It brings down the update latency from 2 minutes to 5 seconds and also provides the output of the changes only.

Demo

Get real-time updates from Notion Databases

How it works

Setup

Example output

[
  {
    "action": "changed",
    "changes": {
      "property_modified_at": "2024-06-04T17:59:00.000Z",
      "property_priority": "important"
    },
    "data": {
      "id": "ba761e03-7d6d-44c2-8e8d-c8a4fb930d0f",
      "name": "Try out n8n",
      "url": "https://www.notion.so/Try-out-n8n-ba761e037d6d44c28e8dc8a4fb930d0f",
      "property_todoist_id": "",
      "property_id": "ba761e037d6d44c28e8dc8a4fb930d0f",
      "property_modified_at": "2024-06-04T17:59:00.000Z",
      "property_status": "Backlog",
      "property_priority": "important",
      "property_due": {
        "start": "2024-06-05",
        "end": null,
        "time_zone": null
      },
      "property_focus": false,
      "property_name": "Try out n8n"
    },
    "updated_at": "2024-06-04T17:59:42.144+00:00"
  }
]

🔗 Nodes Used

HTTP Request, Notion, Supabase, Execute Workflow Trigger, Filter

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup