> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mesa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# webhooks.on()

> Register typed local webhook handlers.

Register handlers that run after `mesa.webhooks.receive(...)` verifies and validates an incoming webhook request.

```ts theme={null}
mesa.webhooks.on('push', async (event) => {
  for (const update of event.data.updates) {
    console.log(update.bookmark, update.action);
  }
});
```

Register the same handler for multiple event names:

```ts theme={null}
mesa.webhooks.on(['push', 'repo.created'], async (event) => {
  console.log(event.type, event.id);
});
```

## Options

<ParamField path="name" type="WebhookEventName | WebhookEventName[]" required>
  Event name or event names to handle.
</ParamField>

<ParamField path="handler" type="WebhookHandler" required>
  Function called with the typed event. It may return `void` or a promise.
</ParamField>

## Event names

Supported event names include `repo.created`, `repo.updated`, `repo.deleted`, `bookmark.created`, `bookmark.deleted`, `bookmark.moved`, `bookmark.merged`, `change.created`, `change.evolved`, `push`, `sync.queued`, `sync.in_progress`, `sync.completed`, and `sync.failed`.

## Response

Returns `void`.

## Handler errors

Handlers are run during `mesa.webhooks.receive(...)`. If one or more handlers reject, `receive` throws an `AggregateError` after all matching handlers have settled.
