Corsair
PluginsPostHog

PostHog Webhooks

All available PostHog webhook events

The PostHog plugin automatically handles incoming webhooks from PostHog. Point your PostHog webhook URL to your Corsair webhook endpoint, and the plugin will automatically process events and update your database.

New to Corsair? Learn about core concepts like webhooks, hooks, and multi-tenancy before setting up webhook handlers.

Full Implementation: For the complete, up-to-date list of all webhook events and their implementations, see the PostHog plugin source code on GitHub.

Setup

Configure your webhook endpoint to handle PostHog events:

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

In your PostHog dashboard, set the webhook URL to:

https://your-domain.com/api/webhook

Available Webhooks

captured

events.captured

Fires when an event is captured in PostHog.

Example Usage:

corsair.ts
posthog({
    webhookHooks: {
        events: {
            captured: {
                after: async (ctx, result) => {
                    console.log("Event captured:", result.data.event);
                },
            },
        },
    },
})

See Webhooks for more details on webhook concepts and Hooks for the complete hooks documentation.