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

  • content
    • contentIndexed (content.contentIndexed)
  • search
    • searchAlert (search.searchAlert)
  • webset
    • websetItemsFound (webset.websetItemsFound)
    • websetSearchCompleted (webset.websetSearchCompleted)

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

Content

Content Indexed

content.contentIndexed A new web page has been indexed by Exa Payload
NameTypeRequiredDescription
typecontent.indexedYes
idstringYes
created_atstringYes
dataobjectYes
{
  url: string,
  title?: string | null,
  publishedDate?: string | null,
  author?: string | null
}
{
  url: string,
  title?: string | null,
  publishedDate?: string | null,
  author?: string | null,
  indexedAt: string
}
webhookHooks example
exa({
    webhookHooks: {
        content: {
            contentIndexed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Search Alert

search.searchAlert A monitored search query has new matching results Payload
NameTypeRequiredDescription
typesearch.alertYes
idstringYes
created_atstringYes
dataobjectYes
{
  query: string,
  results: {
    id: string,
    url: string,
    title?: string | null,
    publishedDate?: string | null,
    author?: string | null,
    score?: number,
    text?: string,
    highlights?: string[],
    summary?: string
  }[]
}
{
  query: string,
  results: {
    id: string,
    url: string,
    title?: string | null,
    publishedDate?: string | null,
    author?: string | null,
    score?: number,
    text?: string,
    highlights?: string[],
    summary?: string
  }[],
  triggeredAt: string
}
webhookHooks example
exa({
    webhookHooks: {
        search: {
            searchAlert: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Webset

Webset Items Found

webset.websetItemsFound New items were found for a webset search Payload
NameTypeRequiredDescription
typewebset.items_foundYes
idstringYes
created_atstringYes
dataobjectYes
{
  webset: {
    id: string,
    object: webset,
    status: idle | running | paused | done,
    externalId?: string,
    createdAt: string,
    updatedAt: string
  },
  items: {
    id: string,
    url: string,
    title?: string | null,
    publishedDate?: string | null,
    author?: string | null,
    score?: number,
    text?: string,
    highlights?: string[],
    summary?: string
  }[],
  itemCount?: number
}
{
  webset: {
    id: string,
    object: webset,
    status: idle | running | paused | done,
    externalId?: string,
    createdAt: string,
    updatedAt: string
  },
  items: {
    id: string,
    url: string,
    title?: string | null,
    publishedDate?: string | null,
    author?: string | null,
    score?: number,
    text?: string,
    highlights?: string[],
    summary?: string
  }[],
  itemCount?: number,
  triggeredAt: string
}
webhookHooks example
exa({
    webhookHooks: {
        webset: {
            websetItemsFound: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})

Webset Search Completed

webset.websetSearchCompleted A webset search has completed Payload
NameTypeRequiredDescription
typewebset.search.completedYes
idstringYes
created_atstringYes
dataobjectYes
{
  webset: {
    id: string,
    object: webset,
    status: idle | running | paused | done,
    externalId?: string,
    createdAt: string,
    updatedAt: string
  },
  totalItems?: number
}
{
  webset: {
    id: string,
    object: webset,
    status: idle | running | paused | done,
    externalId?: string,
    createdAt: string,
    updatedAt: string
  },
  totalItems?: number,
  completedAt: string
}
webhookHooks example
exa({
    webhookHooks: {
        webset: {
            websetSearchCompleted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})