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

  • driveChanged (driveChanged)

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 Changed

Drive Changed

driveChanged A file or folder in Google Drive was created, updated, or deleted Payload
NameTypeRequiredDescription
messageobjectNo
subscriptionstringNo
eventanyNo
{
  data?: string,
  attributes?: {
  },
  messageId?: string,
  publishTime?: string
}
{
  type: fileChanged | folderChanged,
  fileId?: string,
  folderId?: string,
  changeType: created | updated | deleted | trashed | untrashed,
  file?: any,
  folder?: any,
  filePath?: string,
  change?: any,
  binaryData?: string | null,
  allFiles: {
    file: any,
    filePath: string,
    change: any,
    changeType: created | updated | deleted | trashed | untrashed,
    binaryData?: string | null
  }[],
  allFolders: {
    folder: any,
    filePath: string,
    change: any,
    changeType: created | updated | deleted | trashed | untrashed
  }[]
}
webhookHooks example
googledrive({
    webhookHooks: {
        driveChanged: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})