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

**name** `WebhookEventName | WebhookEventName[]` *required*

Event name or event names to handle.

**handler** `WebhookHandler` *required*

Function called with the typed event. It may return `void` or a promise.

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.