/** @return RedeliveredWebhookResource */
public function redeliver(
string $id,
string $deliveryId,
int|float|null $timeout = null,
): arrayRe-queues an event for one endpoint. The original row is never retried, it stays untouched as the historical record, and a brand new delivery is created that reuses the source event id and event type. The returned id is that new delivery and sourceDeliveryId is the one you replayed, so poll the former and not the value you passed in.
Because the event id is reused, your receiver sees the same webhook-id header again. Idempotency on that value is the only thing stopping a replay from applying twice.
Only finished deliveries can be replayed. A source still pending or processing is refused with 409, because the worker still owns it and will retry on its own schedule, so wait for succeeded or failed. The endpoint must also be enabled, and the workspace cap of 500 queued deliveries is a 409 as well.
Example
use Envless\Envless;
$envless = new Envless();
$replay = $envless->webhooks->redeliver(
'0194f2b1-9c3a-7c21-8f0e-2b6d4a1c5e90',
'0194f2c8-11ad-7a03-b6c2-9d70f4e8a112',
);
$queued = $envless->webhooks->getDelivery(
$replay['webhookId'],
$replay['id'],
);
echo "{$replay['sourceDeliveryId']} {$queued['status']}", PHP_EOL;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$id | string | Yes | Endpoint id, which must be enabled and must own the delivery. |
$deliveryId | string | Yes | Source delivery id, which must already be succeeded or failed. |
$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
RedeliveredWebhookResource with the new delivery id, the webhookId, the sourceDeliveryId and the starting status.
Worth knowing
- The new row is created
pendingand the worker picks it up within a few seconds. - Success is 201, since a row is created, and there is no request body.
- A real delivery id under the wrong endpoint id is 404
webhook.delivery_not_found.
Required scopes
webhooks:write
Underlying endpoint
POST /webhooks/{id}/deliveries/{deliveryId}/redeliver
Request and response schema, every error code, and a live playground.
In TypeScript
envless.webhooks.redeliver()
The same method in @goenvless/sdk, with the same request, retries and errors.