Webhooks

envless.webhooks.redeliver()

Queue a fresh delivery attempt for a past event

ts
redeliver(id: string, deliveryId: string, options?: RequestScope): Promise<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 resolved 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

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

const queued = await envless.webhooks.getDelivery(replay.webhookId, replay.id)

console.log(replay.sourceDeliveryId, queued.status)

Parameters

ParameterTypeRequiredDescription
idstringYesEndpoint id, which must be enabled and must own the delivery.
deliveryIdstringYesSource delivery id, which must already be succeeded or failed.
options.signalAbortSignalNoCancels the request.

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 Python

envless.webhooks.redeliver()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.webhooks.redeliver

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->webhooks->redeliver()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.