Webhooks

Envless.webhooks.iterate_deliveries

Stream delivery attempts one at a time

def iterate_deliveries(
  id,
  limit: nil,
  offset: nil,
  status: nil,
  timeout: nil,
  &block
)

Returns an Enumerator 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

ruby
require "envless/sdk"

endpoint_id = "0194f2b1-9c3a-7c21-8f0e-2b6d4a1c5e90"

Envless.webhooks.iterate_deliveries(endpoint_id) do |delivery|
  if delivery[:status] == "failed"
    puts "#{delivery[:id]} #{delivery[:responseStatus]}"
    puts delivery[:error]
    break
  end
end

Parameters

ParameterTypeRequiredDescription
idStringYesEndpoint id whose delivery log is streamed.
status:"pending" | "processing" | "succeeded" | "failed"NoRestricts the stream to one delivery state such as pending.
limit:IntegerNoPage size per request, capped at 100 and defaulting to 100.
offset:IntegerNoRow the walk starts at, advancing by the number of items each page returns.
timeout:Integer | Float | RationalNoSeconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

Enumerator[webhook_delivery_resource, nil] yielding one delivery attempt per step.

Reads the deliveries collection. list returns one page as an Envless::Page with items and pagination, list_all collects every page into an array, and iterate yields one item at a time to a block, fetching the next page only when it gets there. Without a block, iterate returns an Enumerator.

Worth knowing

  • The Enumerator is lazy, so no request is sent until you start consuming it.
  • Rows yielded here never carry responseBody, follow up with get_delivery 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 TypeScript

envless.webhooks.iterateDeliveries()

The same method in @goenvless/sdk, with the same request, retries and errors.