Webhooks

envless.webhooks.iterateDeliveries()

Stream delivery attempts one at a time

ts
iterateDeliveries(id: string, options?: DeliveryListOptions): AsyncGenerator<WebhookDeliveryResource, void, undefined>

Returns an async generator over one endpoint delivery log, fetching the next page only when the current one is drained. Breaking out stops the requests, which is what makes this the right tool for scanning a large log until you hit the first failure.

The ordering is newest first, so new deliveries land at the top of the set the offsets are counted against while you walk. A row can therefore repeat across pages on an active endpoint: de-duplicate on the delivery id if exactness matters. limit is clamped to 100 and only ever makes pages smaller.

Example

ts
for await (const delivery of envless.webhooks.iterateDeliveries('0194f2b1-9c3a-7c21-8f0e-2b6d4a1c5e90')) {
    if (delivery.status === 'failed') {
        console.log(delivery.id, delivery.responseStatus, delivery.error)
        break
    }
}

Parameters

ParameterTypeRequiredDescription
idstringYesEndpoint id whose delivery log is streamed.
options.statusstringNoRestricts the stream to one delivery state such as pending.
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.signalAbortSignalNoCancels the request in flight and ends the iteration.

Returns

AsyncGenerator<WebhookDeliveryResource, void, undefined> yielding one delivery attempt per step.

Reads the deliveries 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 no request is sent until you start consuming it.
  • Rows yielded here never carry responseBody, follow up with getDelivery for the one you care about.

Required scopes

webhooks:read

Underlying endpoint

GET /webhooks/{id}/deliveries

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

In Python

envless.webhooks.iterate_deliveries()

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

In Ruby

Envless.webhooks.iterate_deliveries

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

In PHP

$envless->webhooks->iterateDeliveries()

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