/** @return \Generator<int, WebhookDeliveryResource, mixed, void> */
public function iterateDeliveries(
string $id,
?int $limit = null,
?int $offset = null,
?string $status = null,
int|float|null $timeout = null,
): \GeneratorReturns a 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
use Envless\Envless;
$envless = new Envless();
$endpointId = '0194f2b1-9c3a-7c21-8f0e-2b6d4a1c5e90';
foreach ($envless->webhooks->iterateDeliveries($endpointId) as $delivery) {
if ($delivery['status'] === 'failed') {
echo "{$delivery['id']} {$delivery['responseStatus']}", PHP_EOL;
echo $delivery['error'], PHP_EOL;
break;
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$id | string | Yes | Endpoint id whose delivery log is streamed. |
$status | string | No | Restricts the stream to one delivery state such as pending. |
$limit | int | No | Page size per request, capped at 100 and defaulting to 100. |
$offset | int | No | Row the walk starts at, advancing by the number of items each page returns. |
$timeout | int|float | No | Seconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
Generator<int, WebhookDeliveryResource> yielding one delivery attempt per step.
Reads the deliveries collection. list returns one page as an Envless\Result\Page with items and pagination, listAll collects every page into an array, and iterate returns a Generator that yields one item at a time, fetching the next page only when the loop gets there.
Worth knowing
- The generator is lazy, so no request is sent until you start consuming it.
- Rows yielded here never carry
responseBody, follow up withgetDeliveryfor 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.