Skip to content
Tracking and technical

What is a webhook?

3 min read · Updated · By the Reveata team

Short answerA webhook is an automatic HTTP request, usually a POST with a JSON body, that one service sends to an address you choose as soon as an event happens, such as a new payment, so your system learns about it without having to keep asking.

There are two ways for your server to learn that something changed in another service. It can ask again and again ("any new payments?"), which is called polling. Or the other service can tell it the moment something happens. That second way is a webhook: a "reverse API" where the other side makes the call.

How a webhook works

  1. You give the service an endpoint: a public HTTPS address on your server, such as https://example.com/webhooks/reveata.
  2. You choose the events you care about.
  3. When one happens, the service sends a POST with details in the body.
  4. Your server answers quickly with a 2xx status to say it received it.
  5. If it does not, the service retries later.

Payment providers use webhooks to report charges and refunds, which is also how analytics tools that track revenue usually hear about payments.

Security: verify every delivery

Anyone who knows your endpoint address can send it a request, so a webhook must prove it came from the real sender. The usual method is a signature: the sender computes an HMAC of the request body with a secret only you and it know, and puts it in a header. Your server recomputes it and compares, in constant time. Adding a timestamp to what is signed, and refusing old ones, stops someone replaying a captured request.

Reveata's webhooks

An admin adds endpoints under Site settings → Developer → Webhooks (Webhooks). The events are:

Event Sent when
payment.created A new payment or renewal is recorded, with the channel, source and campaign it is credited to
payment.refunded A refund is recorded
goal.completed A visitor completes a goal (at most one per goal per minute)
alert.fired One of the website's alerts or reports fires
summary.daily Once a day: yesterday's visitors, goals, new customers and net revenue

Each delivery carries Reveata-Event-Id, Reveata-Event, Reveata-Timestamp and Reveata-Signature headers. The signature is a hex HMAC-SHA256 of <timestamp>.<raw body> keyed with the endpoint's whsec_ secret, and Reveata's docs suggest refusing timestamps more than 5 minutes off.

Answer with any 2xx within 10 seconds and do slow work afterwards. Failed deliveries are retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours: 7 attempts over about 21 hours. Endpoints must be public https:// addresses; private and local addresses are refused.

Pitfalls

  • Parsing before verifying. Verify the signature against the raw body. Re-serialised JSON will not match.
  • Duplicates. Retries mean the same event can arrive twice. Store the event id and ignore repeats.
  • Slow handlers. Doing heavy work before answering causes timeouts, which cause retries, which cause more load.
  • Order. Do not assume events arrive in the order they happened.

Frequently asked questions

What is the difference between a webhook and an API?

With an API, your code asks for data when it wants it. With a webhook, the other service pushes data to you when an event happens. Many integrations use both: a webhook says something changed, and an API call fetches the full details.

How do I test a webhook endpoint?

Use the service's test button if it has one. Reveata's Send test delivers a webhook.test event, and each endpoint's Deliveries list shows the status, attempts and last error of every event.

Can I use webhooks with Zapier or Make?

Most automation tools can receive webhooks at an address they give you. Reveata also has its own Zapier and Make integrations.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
GlossaryWhat is an API key?An API key is a long secret string that a program sends with each request to an API, usually in the Authorization header, so the service knows which account is calling and what that caller is allowed to do.GlossaryWhat is server-side tracking?Server-side tracking means your backend, not the visitor's browser, sends events such as sign-ups, payments or page requests to your analytics tool, so they are recorded even when a script is blocked or never runs.GlossaryWhat are Core Web Vitals?Core Web Vitals are three measurements Google uses to describe a page's real-world user experience, namely Largest Contentful Paint (loading), Interaction to Next Paint (responsiveness) and Cumulative Layout Shift (visual stability).GlossaryWhat are event properties?Event properties are key–value details attached to an analytics event, such as the plan chosen or the button clicked on a signup event, so you can break one event down by those details instead of creating a separate event for every variation.GlossaryWhat is a canonical URL?A canonical URL is the one preferred address you want search engines to index and show for a page whose content is reachable at several URLs, usually declared with a rel="canonical" link in the page's head.GlossaryWhat is a Content Security Policy (CSP)?A Content Security Policy (CSP) is a set of rules a website sends to the browser, usually in a Content-Security-Policy header, listing which sources of scripts, styles, images and network connections the page is allowed to use, so injected or unexpected code is blocked.