563848e0ecc0
Drain the webhook delivery DLQ
Pulls failed webhook delivery events from the DLQ Pub/Sub subscription and re-enqueues them as Cloud Tasks for redelivery. Supports filtering by webhookId and tenantId. Use dryRun=true to preview without re-enqueuing. Requires the webhook:create permission and a tenant-id header. Note: the drain does a single bounded pull (maxMessages) and filters client-side, so on a DLQ dominated by other tenants a tenant-scoped drain may pull mostly non-matching messages and need to be re-run; increase maxMessages and/or repeat until the summary shows requeued==0 with an empty pull.
Headers
Caller's tenant identifier. Required. The drain is scoped to this tenant: it overrides any tenantId supplied in the request body so callers cannot drain other tenants' failed webhooks.
Request body
Example request
{
"maxMessages": 100,
"webhookId": "wh_9f8c2b1a4d6e",
"targetQueue": "webhook-delivery"
}Response
Drain summary: counts of messages pulled, re-enqueued, filtered out, and failed, plus per-message results. On a dry run, matching events are reported with status DRY_RUN and none are re-enqueued.
Example response
{
"totalPulled": 12,
"requeued": 8,
"filtered": 3,
"failed": 1,
"results": [
{
"messageId": "7654321098765432",
"webhookId": "wh_9f8c2b1a4d6e",
"tenantId": "tenant_acme",
"status": "REQUEUED",
"detail": "to webhook-delivery"
}
]
}