Webhooks

$envless->webhooks->get()

Read one webhook endpoint by id

php
/** @return WebhookResource */
public function get(string $id, int|float|null $timeout = null): array

Returns a single endpoint with its URL, subscription list, enabled flag and health timestamps. The signing secret is not here and never will be: you get secretLastFour only, so you can tell which secret a receiver holds. If the secret is lost, rotateSecret is the only route back to a working one.

lastSuccessAt and lastFailureAt are the fastest health signal. When one of them looks wrong, listDeliveries holds the detail behind it.

Endpoints are addressed by id alone, a UUIDv7, with no slug form. Passing a name resolves nothing and produces 404 webhook.not_found, the same response as a deleted endpoint.

Example

php
use Envless\Envless;

$envless = new Envless();

$hook = $envless->webhooks->get('0194f2b1-9c3a-7c21-8f0e-2b6d4a1c5e90');

echo $hook['enabled'] ? 'enabled' : 'disabled', PHP_EOL;
echo "{$hook['lastSuccessAt']} {$hook['lastFailureAt']}", PHP_EOL;

Parameters

ParameterTypeRequiredDescription
$idstringYesEndpoint id taken from a list call, ids only.
$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

WebhookResource with eventTypes, enabled, secretLastFour and the last success and failure timestamps.

Worth knowing

  • The event type catalogue lives at its own route, so listEventTypes can never collide with an id read.
  • A 404 does not distinguish an unknown id from an endpoint in another workspace.

Required scopes

webhooks:read

Underlying endpoint

GET /webhooks/{id}

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

In TypeScript

envless.webhooks.get()

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