Recipe

Mirror webhook events into a queue

Acknowledge fast by enqueuing, not processing. Verify the signature, push the raw event onto your own queue, and return 200 in milliseconds. Your workers then process at their own pace with retry logic you control — and you never trip the 10-second delivery timeout.

2 min read

EnqueueThen ack
<10 sNever miss the timeout
Your retriesUnder your control

Receive and enqueue

The webhook handler does the minimum and returns immediately.

app.post('/webhooks', express.raw({type:'*/*'}), async (req, res) => {
  if (!verify(req.body, req.header('Credicorp-Signature'), SECRET))
    return res.status(400).end();
  await queue.push(req.body.toString());   // raw event
  res.status(200).end();
});

Process from the queue

Workers parse, dedupe on the event id, and apply effects. If a worker fails, your queue retries — separate from Credicorp’s delivery retries.

Why this shape

It cleanly separates receipt (must be fast and reliable) from processing (can be slow, can fail, can retry). It is the most robust pattern for high-volume webhooks.

Frequently asked questions

Do I still need idempotency if I have a queue?

Yes. Credicorp may deliver an event twice, so two copies can enter your queue. Dedupe on the event id when you process. See idempotency.

Should I verify before or after enqueuing?

Before. Never let an unverified body into your system. Verify, then enqueue.

Funding for UK limited companies

Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.