Webhooks

envless.webhooks.redeliver()

Queue a fresh delivery attempt for a past event

def redeliver(
    id: str,
    delivery_id: str,
    *,
    timeout: float | None = None,
) -> RedeliveredWebhookResource

Re-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

from envless import envless

replay = envless.webhooks.redeliver(
    '0194f2b1-9c3a-7c21-8f0e-2b6d4a1c5e90',
    '0194f2c8-11ad-7a03-b6c2-9d70f4e8a112',
)

queued = envless.webhooks.get_delivery(
    replay['webhookId'], replay['id']
)

print(replay['sourceDeliveryId'], queued['status'])

Parameters

ParameterTypeRequiredDescription
idstrYesEndpoint id, which must be enabled and must own the delivery.
delivery_idstrYesSource delivery id, which must already be succeeded or failed.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. 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 pending and 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.