Corsair
PluginsNotion

Notion Webhooks

All available Notion webhook events

The Notion plugin includes webhook handlers for Notion database page events.

New to Corsair? Learn about webhooks and hooks.

Full Implementation: See the Notion plugin source code.

Setup

app/api/webhook/route.ts
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";

export async function POST(request: Request) {
    const headers = Object.fromEntries(request.headers);
    const body = await request.json();

    const result = await processWebhook(corsair, headers, body);
    return result.response;
}

Notion webhooks are identified by the x-notion-signature header.

Available Webhooks

databasePages.pageCreated

Fires when a page is created in a database.

Example:

corsair.ts
notion({
    webhookHooks: {
        "databasePages.pageCreated": async (event) => {
            console.log("Page created:", event.id);
            console.log("Database:", event.parent?.database_id);
        },
    },
})

Key fields: id, created_time, last_edited_time, properties, parent, url


databasePages.pageUpdated

Fires when a page is updated in a database.

Example:

corsair.ts
notion({
    webhookHooks: {
        "databasePages.pageUpdated": async (event) => {
            console.log("Page updated:", event.id);
            console.log("Properties:", event.properties);
        },
    },
})

Key fields: id, created_time, last_edited_time, properties, parent, url


verification

Fires during Notion's URL verification handshake when you register a webhook endpoint.

Corsair handles this automatically — no additional configuration is needed.

Example:

corsair.ts
notion({
    webhookHooks: {
        "verification": async (event) => {
            // Corsair responds automatically; this hook fires for observability
            console.log("Webhook verified");
        },
    },
})