> ## 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.

# Webhooks

> UniOne incoming webhooks: event paths, payloads, and response data.

The UniOne plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](/plugins/unione/overview) for setup context and the exact URL shape).

<Info>
  **New to Corsair?** See [webhooks](/concepts/webhooks) and [hooks](/concepts/hooks).
</Info>

## Webhook map

* `emailStatus` (`emailStatus`)
* `spamBlock` (`spamBlock`)

## HTTP handler setup

```ts app/api/webhook/route.ts theme={null}
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

## Email Status

### Email Status

`emailStatus`

Transactional email status events from UniOne

**Payload**

| Name             | Type       | Required | Description |
| ---------------- | ---------- | -------- | ----------- |
| `auth`           | `string`   | No       | —           |
| `events_by_user` | `object[]` | No       | —           |

<AccordionGroup>
  <Accordion title="events_by_user full type">
    ```ts theme={null}
    {
      user_id?: string | number,
      project_id?: string,
      project_name?: string,
      events?: {
        event_name: string,
        event_data?: {
          job_id?: string,
          email?: string,
          status?: string,
          event_time?: string
        }
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      auth?: string,
      events_by_user?: {
        user_id?: string | number,
        project_id?: string,
        project_name?: string,
        events?: {
          event_name: string,
          event_data?: {
            job_id?: string,
            email?: string,
            status?: string,
            event_time?: string
          }
        }[]
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
unione({
    webhookHooks: {
        emailStatus: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***

## Spam Block

### Spam Block

`spamBlock`

SMTP spam-block events from UniOne

**Payload**

| Name             | Type       | Required | Description |
| ---------------- | ---------- | -------- | ----------- |
| `auth`           | `string`   | No       | —           |
| `events_by_user` | `object[]` | No       | —           |

<AccordionGroup>
  <Accordion title="events_by_user full type">
    ```ts theme={null}
    {
      user_id?: string | number,
      project_id?: string,
      project_name?: string,
      events?: {
        event_name: string,
        event_data?: {
          job_id?: string,
          email?: string,
          status?: string,
          event_time?: string
        }
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

<AccordionGroup>
  <Accordion title="Response data full type">
    ```ts theme={null}
    {
      auth?: string,
      events_by_user?: {
        user_id?: string | number,
        project_id?: string,
        project_name?: string,
        events?: {
          event_name: string,
          event_data?: {
            job_id?: string,
            email?: string,
            status?: string,
            event_time?: string
          }
        }[]
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

**`webhookHooks` example**

```ts theme={null}
unione({
    webhookHooks: {
        spamBlock: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***
