Webhooks

envless.webhooks.iterate()

Stream webhook endpoints one at a time

ts
iterate(options?: SortedListOptions): AsyncGenerator<WebhookResource, void, undefined>

Returns an async generator that yields endpoints individually and fetches the next page only once the current one is drained. Nothing is requested until you start consuming it, and breaking out of the loop stops the requests, so this is the cheapest way to find the endpoint pointed at one URL.

The generator defaults to the maximum page size of 100 and clamps anything larger, so limit only ever makes pages smaller. Creating or deleting endpoints while you iterate shifts the offsets the walk counts against, so collect ids first and act on them after the loop.

Example

ts
for await (const hook of envless.webhooks.iterate()) {
    if (hook.url === 'https://hooks.example.com/envless') {
        console.log(hook.id, hook.eventTypes)
        break
    }
}

Parameters

ParameterTypeRequiredDescription
options.limitnumberNoPage size per request, capped at 100 and defaulting to 100.
options.offsetnumberNoRow the walk starts at, advancing by the number of items each page returns.
options.searchstringNoCase insensitive substring match across name, url and description.
options.orderstringNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
options.signalAbortSignalNoCancels the request in flight and ends the iteration.

Returns

AsyncGenerator<WebhookResource, void, undefined> yielding one endpoint per step.

Reads the webhooks collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.

Worth knowing

  • The generator is lazy, so an abandoned loop costs at most the pages you consumed.

Required scopes

webhooks:read

Underlying endpoint

GET /webhooks

Request and response schema, every error code, and a live playground.

In Python

envless.webhooks.iterate()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.webhooks.iterate

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->webhooks->iterate()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.