Skip to main content
The Onedrive 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

  • drive
    • driveNotification (drive.driveNotification)
    • validation (drive.validation)

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

Drive

Drive Notification

drive.driveNotification Microsoft Graph drive change notification — item created, updated, or deleted Payload
NameTypeRequiredDescription
valueobject[]Yes
{
  subscriptionId: string,
  changeType: string,
  clientState?: string,
  resource?: string,
  resourceData?: {
  },
  tenantId?: string,
  subscriptionExpirationDateTime?: string
}[]
{
  subscriptionId: string,
  changeType: string,
  clientState?: string,
  resource?: string,
  resourceData?: {
  },
  tenantId?: string,
  subscriptionExpirationDateTime?: string
}
webhookHooks example
onedrive({
    webhookHooks: {
        drive: {
            driveNotification: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Validation

drive.validation Microsoft Graph OneDrive webhook validation handshake Payload
NameTypeRequiredDescription
validationTokenstringYes
{
  validationToken: string
}
webhookHooks example
onedrive({
    webhookHooks: {
        drive: {
            validation: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})