Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt

Use this file to discover all available pages before exploring further.

The Notion plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see Overview for setup context and the exact URL shape).
New to Corsair? See webhooks and hooks.

Webhook map

  • databasePages
    • pageCreated (databasePages.pageCreated)
    • pageUpdated (databasePages.pageUpdated)
  • verification (verification)

HTTP handler 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;
}

Events

Database Pages

Page Created

databasePages.pageCreated A page was created in a database Payload
NameTypeRequiredDescription
idstringYes
timestampstringYes
workspace_idstringYes
subscription_idstringYes
integration_idstringYes
typepage.createdYes
authorsobject[]Yes
accessible_byobject[]Yes
entityobjectYes
dataobjectYes
{
  id: string,
  object: string,
  type?: string,
  name?: string,
  avatar_url?: string
}[]
{
  id: string,
  object: string,
  type?: string,
  name?: string,
  avatar_url?: string
}[]
{
  id: string,
  object: string
}
{
  page_id: string,
  database_id: string
}
{
  id: string,
  timestamp: string,
  workspace_id: string,
  subscription_id: string,
  integration_id: string,
  type: page.created,
  authors: {
    id: string,
    object: string,
    type?: string,
    name?: string,
    avatar_url?: string
  }[],
  accessible_by: {
    id: string,
    object: string,
    type?: string,
    name?: string,
    avatar_url?: string
  }[],
  entity: {
    id: string,
    object: string
  },
  data: {
    page_id: string,
    database_id: string
  }
}
webhookHooks example
notion({
    webhookHooks: {
        databasePages: {
            pageCreated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Page Updated

databasePages.pageUpdated A page was updated in a database Payload
NameTypeRequiredDescription
idstringYes
timestampstringYes
workspace_idstringYes
subscription_idstringYes
integration_idstringYes
typepage.updatedYes
authorsobject[]Yes
accessible_byobject[]Yes
entityobjectYes
dataobjectYes
{
  id: string,
  object: string,
  type?: string,
  name?: string,
  avatar_url?: string
}[]
{
  id: string,
  object: string,
  type?: string,
  name?: string,
  avatar_url?: string
}[]
{
  id: string,
  object: string
}
{
  page_id: string,
  database_id: string
}
{
  id: string,
  timestamp: string,
  workspace_id: string,
  subscription_id: string,
  integration_id: string,
  type: page.updated,
  authors: {
    id: string,
    object: string,
    type?: string,
    name?: string,
    avatar_url?: string
  }[],
  accessible_by: {
    id: string,
    object: string,
    type?: string,
    name?: string,
    avatar_url?: string
  }[],
  entity: {
    id: string,
    object: string
  },
  data: {
    page_id: string,
    database_id: string
  }
}
webhookHooks example
notion({
    webhookHooks: {
        databasePages: {
            pageUpdated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Verification

Verification

verification Notion URL verification — respond to confirm the webhook endpoint Payload
NameTypeRequiredDescription
verification_tokenstringYes
{
  type: url_verification,
  verification_token: string
}
webhookHooks example
notion({
    webhookHooks: {
        verification: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})