Webhooks

$envless->webhooks->listAll()

Collect every webhook endpoint into one array

php
/** @return list<WebhookResource> */
public function listAll(
    ?int $limit = null,
    ?int $offset = null,
    ?string $search = null,
    ?string $order = null,
    int|float|null $timeout = null,
): array

Walks the pages and returns a flat array of every live endpoint. The 20 endpoint cap means this is a single request in practice, which makes it the normal way to load a settings screen.

The pagination envelope is dropped, so totalCount and hasMore are gone. Secrets are still absent from every row, so use create or rotateSecret if you need a usable secret rather than secretLastFour.

Example

php
use Envless\Envless;

$envless = new Envless();

$hooks = $envless->webhooks->listAll();

foreach ($hooks as $hook) {
    if ($hook['enabled'] && $hook['lastFailureAt'] !== null) {
        echo "{$hook['id']} {$hook['lastSuccessAt']}", PHP_EOL;
    }
}

Parameters

ParameterTypeRequiredDescription
$limitintNoPage size used while walking, capped at 100 and defaulting to 100.
$offsetintNoRow the walk starts from, so earlier endpoints are left out of the result.
$searchstringNoCase insensitive substring match applied to every page.
$orderstringNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
$timeoutint|floatNoSeconds 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

list<WebhookResource> holding each live endpoint in the workspace.

Reads the webhooks 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

  • A failure on any page fails the whole call and the rows already collected are lost.
  • Refused for project fenced keys, like every other method here.

Required scopes

webhooks:read

Underlying endpoint

GET /webhooks

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

In TypeScript

envless.webhooks.listAll()

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