Skip to content

Glossary

Webhook: an HTTP callback sent when an event happens

A webhook is an HTTP request a service sends to your URL when an event occurs. Payloads, signature checks, retries and deduplication, with a signing example.

Updated 2026-11-23

A webhook is a callback over HTTP. You give a service a URL, and when an event occurs it sends a POST request with a JSON description to that URL. You are told when something happens instead of repeatedly asking.

How it works

The usual contract has four parts: the event, the payload, the proof of origin and the retry policy.

Part Typical design
Event A named type such as bulk.completed
Payload JSON with an id, a type, a timestamp and the data
Authenticity A signature header computed with a shared secret
Delivery Retried when your endpoint does not answer with a 2xx

Qelka uses this shape. The events are bulk.completed, sent when a bulk job finishes, and credits.low, sent when the balance falls under 10% of the plan's monthly credits. Each payload has id (starting with evt_), type, created_at and data. The X-Signature header holds a timestamp and a v1 value, the hex HMAC-SHA256 of <t>.<raw body> keyed with the webhook's secret. Verify it against the raw bytes, with a 5-minute tolerance, using the SDK's verifyWebhook or your own code:

javascript
import { createHmac, timingSafeEqual } from 'node:crypto'

export function isValid(rawBody, timestamp, signature, secret) {
  const expected = createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex')
  const a = Buffer.from(expected)
  const b = Buffer.from(signature)
  return a.length === b.length && timingSafeEqual(a, b)
}

Answer with a 2xx within 10 seconds, then do heavy work afterwards. A failed delivery is retried up to 5 times with increasing delays, so the same event can arrive more than once and out of order. Deduplicate on the event id, see idempotency key, and rely on created_at and the state in data rather than arrival order.

Security basics: serve the endpoint over HTTPS, keep the secret out of code and logs, parse the body only after verifying, and treat the User-Agent as a label, not authentication. Full details are in webhooks.

Why it matters for validation

Validation work is often long: cleaning a very large list of addresses cannot finish inside one HTTP call. Qelka's bulk jobs run in the background and tell you through a webhook when done, so your system can fetch the results without polling. The credits.low event lets you top up before calls start failing with insufficient_credits.

A solid handler:

  1. Read the raw body and verify the signature.
  2. Look up the event id; stop if seen.
  3. Store the event and answer 200.
  4. Process asynchronously, and tolerate retries.

Use rate limiting on your own endpoint too, since it is public.

Frequently asked questions

What is a webhook?
A webhook is an HTTP POST request that a service sends to a URL you provide when something happens, such as a job finishing. It replaces polling: instead of asking repeatedly whether the work is done, you are told once. The request carries a JSON body describing the event.
How do I verify a webhook is genuine?
Check the signature. The sender computes an HMAC of the raw request body with a secret only you and it share, and sends the result in a header. You compute the same HMAC and compare in constant time. Reject requests that do not match, and use a timestamp to block replays.
Why do I receive the same webhook twice?
Because delivery is at least once. If your server processes an event but answers too late or fails, the sender retries. Store the event id of every event you handle and skip ids you have already seen, so a repeat does nothing.

Put this check in your product

Get an API key in under a minute. 100 free credits every month, no card required.

  • 100 free credits a month
  • No card
  • Test keys spend nothing
  • Cancel any time